I am having a rough time trying to figure this out.
So I have a dockerfile based on an Ubuntu image. At the end of my dockerfile I have:
CMD django-admin startproject $PROJECTNAME
I was told in a previous post that the base Ubuntu image has a CMD to run /bin/bash so my command is actually overwriting this (not sure if this is relevant or not).
The problem I'm encountering is if I run:
docker run -i -t <containerid>
Nothing happens.. docker ps shows no containers are running
But if I run:
docker run -i -t <containerid> /bin/bash
The container starts running, I am in the shell, and docker ps shows that this container is running. Everything works as expected, but my django project is not there and my understanding is that running /bin/bash overrides the CMD in the dockerfile, which means django-admin startproject never gets run.
From inside the container, I can run django-admin startproject $projectname and it creates the project with no issues, which tells me django and all its dependencies are installed, and my environment variables are being registered.
However, I still suspect that there maybe is an issue with my CMD in my dockerfile and I don't know where to go from here.
With my provided dockerfile, if I do not run the container with /bin/bash, the container will not run.
Output of docker images:
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> cbec557d6362 About a minute ago 579 MB
<none> <none> 6919c19b159a 16 hours ago
docker run:
docker run -i -t cbec557d6362