# Debugging non-working container

**URL:** <https://forums.docker.com/t/debugging-non-working-container/17916>\
**Category:** General\
**Tags:** docker\
**Created:** [July 11, 2016, 11:58pm UTC](https://forums.docker.com/t/debugging-non-working-container/17916 "2016-07-11T23:58:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![larrymartell59](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/larrymartell59/32/6866_2.png) [@larrymartell59](https://forums.docker.com/u/larrymartell59)\
**Post date:** [July 11, 2016, 11:58pm UTC](https://forums.docker.com/t/debugging-non-working-container/17916/1 "2016-07-11T23:58:12Z")

</div>

I have a container and when I start it it exits after a few seconds with no output. How can I debug this to see where the issue is?d

---

<div class="post-metadata">

**Author:** ![johnharris85](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/johnharris85/32/7325_2.png) [@johnharris85](https://forums.docker.com/u/johnharris85)\
**Post date:** [July 11, 2016, 11:59pm UTC](https://forums.docker.com/t/debugging-non-working-container/17916/2 "2016-07-11T23:59:33Z")

</div>

Are you able to post your Dockerfile & the command you are using to run the container?

Also what does the output of `$ docker logs <container>` show?

---

<div class="post-metadata">

**Author:** ![larrymartell59](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/larrymartell59/32/6866_2.png) [@larrymartell59](https://forums.docker.com/u/larrymartell59)\
**Post date:** [July 12, 2016, 12:09am UTC](https://forums.docker.com/t/debugging-non-working-container/17916/3 "2016-07-12T00:09:34Z")

</div>

docker logs gives no output. Here is the Dockerfile:

> FROM debian:jessie  
> MAINTAINER Larry Martell [larry.martell@elucidbio.com](mailto:larry.martell@elucidbio.com)

> ENV HOME /opt/django/CAPgraph/

> RUN (apt-get update && DEBIAN\_FRONTEND=noninteractive apt-get install -y build-essential git python python-dev python-setuptools nginx sqlite3 supervisor mysql-server libmysqlclient-dev vim cron unzip)  
> RUN (easy\_install pip &&  
> pip install uwsgi)

> ADD . $HOME  
> RUN pip install -r $HOME/requirements.txt  
> RUN chmod 777 /opt/django  
> RUN chmod 777 $HOME

> ADD deploy/stardog/stardog-4.0.zip $HOME/stardog-4.0.zip  
> RUN cd $HOME && unzip stardog-4.0.zip && rm stardog-4.0.zip && mv stardog-4.0 stardog  
> ENV STARDOG\_HOME $HOME/cap\_data/knowledge  
> ADD deploy/stardog/stardog-license-key.bin $HOME/deploy/stardog/stardog-license-key.bin  
> ADD deploy/stardog/init $HOME/deploy/stardog/init

> COPY deploy/util /usr/local/bin  
> RUN chmod a+x /usr/local/bin/reset\_CAPgraph /usr/local/bin/start\_CAPgraph /usr/local/bin/stop\_CAPgraph

> RUN (echo “daemon off;” \>\> /etc/nginx/nginx.conf &&  
> rm /etc/nginx/sites-enabled/default &&  
> ln -s /opt/django/CAPgraph/django.conf /etc/nginx/sites-enabled/ &&  
> ln -s /opt/django/CAPgraph/supervisord.conf /etc/supervisor/conf.d/)

> ADD mysql /var/lib/mysql

> VOLUME [“/opt/django/CAPgraph”]  
> VOLUME [“/var/lib/mysql”]  
> EXPOSE 80 8006  
> ADD crontab /etc/cron.d/backupMySQL  
> RUN chmod 0644 /etc/cron.d/backupMySQL  
> RUN touch /var/log/cron.log

> CMD [“/opt/django/CAPgraph/run.sh”]

The run.sh has:

> chown -R mysql:mysql /var/lib/mysql  
> mysql\_install\_db --user=mysql --ldata=/var/lib/mysql/  
> /usr/bin/mysqld\_safe &  
> sleep 5  
> mysql -u root -e “CREATE DATABASE IF NOT EXISTS elucid”  
> mysql -u root -e “SET PASSWORD FOR ‘root’@‘localhost’ = PASSWORD(‘xxxxxx’)”

> chmod 0777 /opt/django/CAPgraph/scripts/backupMySQL.py  
> set -e

> sed -i “s#module=website.wsgi:application#module=wsgi:application#g” /opt/django/CAPgraph/uwsgi.ini  
> sed -i ‘/session required pam\_loginuid.so/c#session required pam\_loginuid.so’ /etc/pam.d/cron

> python /opt/django/CAPgraph/manage.py collectstatic --noinput  
> rm -f /opt/django/CAPgraph/app.sock  
> rm -f /opt/django/CAPgraph/cap\_data/knowledge/system.lock  
> /opt/django/CAPgraph/stardog/bin/stardog-admin server start

> exec /usr/bin/supervisord

I run it like this:

> docker run -d -v /projects/elucid/CAPgraph:/opt/django/CAPgraph -v /projects/elucid/CAPgraph/mysql:/var/lib/mysql -v /etc/localtime:/etc/localtime -v /projects/cap\_data:/opt/django/CAPgraph/cap\_data -p 8004:80 -p 8006:8006 -p 45820:5820 elucidbio/capgraph:local

When I first ran it I got this error:

> /opt/django/CAPgraph/run.sh: line 19: /opt/django/CAPgraph/stardog/bin/stardog-admin: No such file or directory

So I wanted to start the container with a shell and look around. So I commented out the run script in the Dockerfile and made a new image. And when I run that I get nothing and the container exits.

---

<div class="post-metadata">

**Author:** ![dmaze](https://avatars.discourse-cdn.com/v4/letter/d/ea5d25/32.png) [@dmaze](https://forums.docker.com/u/dmaze)\
**Post date:** [July 12, 2016, 12:27am UTC](https://forums.docker.com/t/debugging-non-working-container/17916/4 "2016-07-12T00:27:27Z")

</div>

> [@larrymartell59](#):
>
> So I wanted to start the container with a shell and look around. So I commented out the run script in the Dockerfile and made a new image. And when I run that I get nothing and the container exits.

You don’t need to comment anything out; anything you pass in the `docker run` command overrides the `CMD` in the Dockerfile. It’s extremely common to

```auto
docker run --rm -it mycontainername bash

```

to try to do exactly this sort of debugging.

---

<div class="post-metadata">

**Author:** ![larrymartell59](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/larrymartell59/32/6866_2.png) [@larrymartell59](https://forums.docker.com/u/larrymartell59)\
**Post date:** [July 12, 2016, 2:43pm UTC](https://forums.docker.com/t/debugging-non-working-container/17916/5 "2016-07-12T14:43:24Z")

</div>

Thanks very much. This is what I needed to know. I was able to find the issues and get it working.
