Ask Your Question
0

Cannot setup network: Cannot find any PID under container

asked 2016-02-22 04:53:14 -0600

raimonbosch gravatar image

updated 2016-02-22 15:06:57 -0600

Hi,

I am using nova-docker to run docker containers from Openstack. Some of my containers are not able to setup network and they give this error: Cannot setup network: Cannot find any PID under container

I have already tried to set tty:True on the driver.py and it still fails. When I fire up those docker by using "docker run -it --net bridge ..." everything works fine. I guess that there is a problem assigning the correct network on nova-docker.

Thanks in advance,

2016-02-22 10:22:34.400 5146 WARNING novadocker.virt.docker.driver [req-c29f063d-f54b-44d1-b608-82face013275 bdc8aedaf84b4ed8a8d2659928a3d0af 3407b066d1f542668f70715d5597a680 - - -] [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6] Cannot setup network: Cannot find any PID under container "79520cf58bfad8770399b86844513369ae42b7e33b100245f45101df1905ee7a"
2016-02-22 10:22:34.400 5146 TRACE novadocker.virt.docker.driver [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6] Traceback (most recent call last):
2016-02-22 10:22:34.400 5146 TRACE novadocker.virt.docker.driver [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6]   File "/usr/local/lib/python2.7/dist-packages/novadocker/virt/docker/driver.py", line 406, in _start_container
2016-02-22 10:22:34.400 5146 TRACE novadocker.virt.docker.driver [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6]     self._attach_vifs(instance, network_info)
2016-02-22 10:22:34.400 5146 TRACE novadocker.virt.docker.driver [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6]   File "/usr/local/lib/python2.7/dist-packages/novadocker/virt/docker/driver.py", line 214, in _attach_vifs
2016-02-22 10:22:34.400 5146 TRACE novadocker.virt.docker.driver [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6]     raise RuntimeError(msg.format(container_id))
2016-02-22 10:22:34.400 5146 TRACE novadocker.virt.docker.driver [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6] RuntimeError: Cannot find any PID under container "79520cf58bfad8770399b86844513369ae42b7e33b100245f45101df1905ee7a"
2016-02-22 10:22:34.400 5146 TRACE novadocker.virt.docker.driver [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6] 
2016-02-22 10:22:34.421 5146 ERROR nova.compute.manager [req-c29f063d-f54b-44d1-b608-82face013275 bdc8aedaf84b4ed8a8d2659928a3d0af 3407b066d1f542668f70715d5597a680 - - -] [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6] Instance failed to spawn
2016-02-22 10:22:34.421 5146 TRACE nova.compute.manager [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6] Traceback (most recent call last):
2016-02-22 10:22:34.421 5146 TRACE nova.compute.manager [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6]   File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 2473, in _build_resources
2016-02-22 10:22:34.421 5146 TRACE nova.compute.manager [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6]     yield resources
2016-02-22 10:22:34.421 5146 TRACE nova.compute.manager [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6]   File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 2345, in _build_and_run_instance
2016-02-22 10:22:34.421 5146 TRACE nova.compute.manager [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6]     block_device_info=block_device_info)
2016-02-22 10:22:34.421 5146 TRACE nova.compute.manager [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6]   File "/usr/local/lib/python2.7/dist-packages/novadocker/virt/docker/driver.py", line 449, in spawn
2016-02-22 10:22:34.421 5146 TRACE nova.compute.manager [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6]     self._start_container(container_id, instance, network_info)
2016-02-22 10:22:34.421 5146 TRACE nova.compute.manager [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6]   File "/usr/local/lib/python2.7/dist-packages/novadocker/virt/docker/driver.py", line 414, in _start_container
2016-02-22 10:22:34.421 5146 TRACE nova.compute.manager [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6]     instance_id=instance['name'])
2016-02-22 10:22:34.421 5146 TRACE nova.compute.manager [instance: f0c9868f-3753-4ba7-b8ad-dc5e8e728bc6] InstanceDeployFailure: Cannot setup network: Cannot find any PID under container "79520cf58bfad8770399b86844513369ae42b7e33b100245f45101df1905ee7a
edit retag flag offensive close merge delete

Comments

Hi, Facing the same issue. Am using the customized docker image from https://hub.docker.com/r/praveenn/ngi... When i uploaded this docker image to OpenStack glance, am not able to launch container although container runs smoothly in standalone linux host following that link.

Praveen N gravatar imagePraveen N ( 2016-08-26 01:15:26 -0600 )edit

Please suggest what needs to modified in that Dockerfile while building the image which i can use for OpenStack (nova-docker) --Regards

Praveen N gravatar imagePraveen N ( 2016-08-26 01:16:47 -0600 )edit

Finally i was able to manage.--Regards

Praveen N gravatar imagePraveen N ( 2016-08-28 22:35:40 -0600 )edit

Hello Praveen, can you please share how you did to solve the issue? I am facing the same issue and many workaround didn't help me so far. Best regards, Giang.

giang gravatar imagegiang ( 2016-08-31 02:15:31 -0600 )edit

Hello giang, i modified my Dockerfile and then created the docker image which is fully functional. FYI nginx_customized_docker

Praveen N gravatar imagePraveen N ( 2016-09-27 23:12:41 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-02-22 08:35:42 -0600

raimonbosch gravatar image

updated 2016-09-22 05:08:37 -0600

Ok,

Again answering myself my questions. This particular docker container was not supposed to be running permanently. The nova-docker driver somehow tries to look for a pid associated to this container. If the container has already finished his job to do, then it can't be registered to Openstack.

So my dirty solution was to add something like that on my docker-entrypoint.sh:

if [ "$@" ]

then

exec "$@"

else

echo "Container running!"

sleep 3h

fi

So when I start this container without parameters (which is the case of nova-docker), I just sleep so everyone knows that this container has to be registered on OpenStack and nothing fails.

I guess that it would be good to give support to this kind of containers on nova-docker. If not, it is necessary to perform hacks like this in all your containers.

Cheers,

EDIT: You can add your entrypoint at the end of the Dockerfile. Make sure that it is located in the same folder that your Dockerfile:

COPY docker-entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]

EXPOSE 80 22 30000-60000

edit flag offensive delete link more

Comments

Hello raimonbosch, can you please elaborate your solution? Where did you store the docker-entrypoint.sh file? How did you execute that script?

giang gravatar imagegiang ( 2016-08-31 10:34:16 -0600 )edit

@raimonbosch: I would prefer having an answer for "giang"'s question, too. Reason: I observe the same issue regarding: Cannot setup network: Cannot find any PID under container when trying to launch a docker image ("docker.io/centos") although it owns a CMD command: CMD ["/bin/bash"]

holger-king gravatar imageholger-king ( 2016-09-22 03:50:37 -0600 )edit

@holger-king In my case the containers where not found because they were stopping early. That should not happen very often. @giang: The entrypoint is usually defined at the end of the Dockerfile.

raimonbosch gravatar imageraimonbosch ( 2016-09-22 04:54:02 -0600 )edit

@raimonbosch: according to the CMD command in the docker image I chose (here: "docker.io/centos") the docker instance should not end - so the nova-docker driver should find a PID (here for "/bin/bash"). Any ideas why I still get the error? Interesting: with image "rastasheep/ubuntu-sshd" it works!

holger-king gravatar imageholger-king ( 2016-09-22 07:30:57 -0600 )edit

@holger-king The problem is that nova-docker does not send any parameter to the container. So you have to provide some kind of logic to your container to work without the "/bin/bash" parameter.

raimonbosch gravatar imageraimonbosch ( 2016-09-22 10:06:20 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2016-02-22 04:53:14 -0600

Seen: 532 times

Last updated: Sep 22 '16