Reputation: 11
I'm trying to create a docker container that adds python image from docker hub using a chef recipe. After chef-client run, I can see the container but it is not getting started even after issuing start command.
Here is my cookbook recipe to pull python image,
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
Below is the issue with the container,
root@ubuntunode2-vm:~# docker start 2e512235c0fe
2e512235c0feroot@ubuntunode2-vm:~# docker exec -it 2e512235c0fe bash
Error response from daemon: Container 2e512235c0fe50b6314648b9d6eae6162790e0793008344d27288d95c69d4923 is not running
Hightlighted container in the screenshot is created through chef recipe
Upvotes: 1
Views: 171
Reputation: 584
Python's interactive shell needs tty in order to run, add tty: true
to the docker_container block and you should be good to go.
Upvotes: 0
Reputation: 10102
since your question does not include full details, the answer will be focused on your recipe.
under the assumption that you are using docker cookbook:
docker_installtion
resource. i prefer docker_installation_package
resource, in order to use the linux repository package of docker and pin the package versionservice
resource. note that, there is docker_service
resource within the docker cookbook, but i prefer the native service methoddocker_image
resourcedocker_container
resource to run the pulled docker imageUpvotes: 1