question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Container not starting after creation

See original GitHub issue

Ubuntu: 14.04 (x64) docker.io: 0.9.1~dfsg1-2 ( docker-py: 0.4.0 (installed via pip)

I’m trying to start a container with docker-py, but c.start(…) only returns None. This is the test-script I’ve been using:

import docker
from pprint import pprint

c = docker.Client(base_url='unix://var/run/docker.sock',
          version="1.10",
          timeout=20)
c.version()
print("Images:")
print("======")
pprint(c.images())
my_container = c.create_container('ubuntu', '/bin/bash')


print("my_container:")
print("============")
pprint(my_container)

print("------------------------")
print("trying to start %s" % (my_container['Id'], ))
erg = c.start(my_container['Id'])
print("erg: %s" % (erg, ))

And this is my output. Am I missing something?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
ColinHuangcommented, Aug 30, 2014

You have to set tty=True, stdin_open=True, parameters when create a new container.

0reactions
fkromercommented, Apr 19, 2018

I am using tty=True and stdin_open=True

import docker
client = docker.from_env()
rcappdb = client.containers.run('rcapplication_database:latest', command='rcapplication_database_create /database new.db', tty=True, stdin_open=True, detach=True)
rcappdb.exec_run(['rcapplication_database_devserver', '/database', 'new.db']) # is the container not running here for at least 3 seconds?
(some Traceback)
APIError: 500 Server Error: Internal Server Error ("Container 9707dbaed711af4fee65981416e22773d5f281d76666e32ca8fbdc6b3aeecc37 is not running")

… but I have still the problem that the container goes into exit after 3 seconds?

❯ docker ps -a
CONTAINER ID        IMAGE                            COMMAND                  CREATED             STATUS                         PORTS               NAMES
9707dbaed711        rcapplication_database:latest    "rcapplication_dat..."   4 seconds ago       Exited (0) 1 second ago                            brave_davinci
Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker container not starting (docker start) - Stack Overflow
I created the container with the following command:
Read more >
Container not getting started after start command issued
Hi, I have just started working with Docker installation and practices through CLI. As a first practice, I have executed the command docker ......
Read more >
Failed to start Container after reboot - DevOps Stack Exchange
Starting a new container works fine. How can a fix, it and sould the container not start by itself because of "--restart alway"...
Read more >
Debugging docker container that won't start | by suprit shah
Being a developer, the first thing we do is to see the logs and any error code. Using a docker command to see...
Read more >
Why Does My Docker Container Stop? - Tutorial Works
If you run a container and it terminates immediately, it is frustrating to figure out what's going on. But fear not. You can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found