Docker Community Forums

Share and learn in the Docker community.

Docker container is not running

I have created a container using chef recipe to pull an image for python in ubuntu 16.04. After creating the container it exits automatically, even if I use docker start containerid it stops instantly.

docker_service 'default' do
  action [:create, :start]
end

docker_image 'python' do
  tag 'latest'
  action :pull
end

docker_container 'testpy' do
  repo 'python'
  tag 'latest'
  action :run
end

Here is my container,

After running start command, it has started but not getting listed after executing docker ps command.

The issue is neither the image, nor your chef receipe. It is your expectation of what the image would do.

The image itself will result in a container that executes python3 and exits immediatly if no interactive terminal is available. There is nothing executed that keeps the container buisy/running.

1 Like

How does a container created directly in docker is being active after start command?


The containers in above screenshot is created manually from docker using docker run command.

Your chef receipe does the same as ‘docker run -d python:latest’, which will result in immediatly exited containers.

Share the exact commands you used to create them, and i will tell you why they are still active :slight_smile:
For instance the 2nd container must have been started with a command like this ‘docker run -ti -d python:latest /bin/bash’ The 3rd propably with ‘docker run -ti -d python:latest’