docker run ubuntu failing
Docker Run Fails - Sometimes
I am trying to run the command below which fails.
docker run ubuntu
When logged into weblish I can see that there is an interface conflict. See below:
root@7-7-7-7:~# docker run ubuntu [ 293.800485] docker0: port 1(vethe500ffc) entered blocking state [ 293.802456] docker0: port 1(vethe500ffc) entered disabled state [ 293.803757] device vethe500ffc entered promiscuous mode [ 293.805258] IPv6: ADDRCONF(NETDEV_UP): vethe500ffc: link is not ready [ 294.164608] eth0: renamed from veth4f340e7 [ 294.180586] IPv6: ADDRCONF(NETDEV_CHANGE): vethe500ffc: link becomes ready [ 294.181764] docker0: port 1(vethe500ffc) entered blocking state [ 294.182634] docker0: port 1(vethe500ffc) entered forwarding state [ 294.387202] docker0: port 1(vethe500ffc) entered disabled state [ 294.388223] veth4f340e7: renamed from eth0 [ 294.434548] docker0: port 1(vethe500ffc) entered disabled state [ 294.437407] device vethe500ffc left promiscuous mode [ 294.438173] docker0: port 1(vethe500ffc) entered disabled state root@7-7-7-7:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES root@7-7-7-7:~#
Any ideas as to why this is happening on ubuntu but not on redis docker images? I am hitting a similar issue with the docker python image.
This is normal.
ubuntu is a base docker image intended to build more things on top of, so you have to actually run some command in the ubuntu container, otherwise it will just successfully exit immediately. This doesn't happen with the
redis and other more complex images because they already start up a process so won't close immediately.
I am not sure what your ultimate goal here is so can't advise you precisely, but, if you just want to able to keep the ubuntu container open and run a shell in it, try the command
docker run -it ubuntu
This will run the container but also immediately run a shell. The container will exit once the shell exits.
Another option is to run the container in the background with a command designed to run forever and do nothing, so it won't exit:
% docker run -d ubuntu /bin/bash -c 'sleep infinity'
Later, you can attach and detach a console anytime you like.
% docker exec -it de9c12801ba342ecf08cda82acf097bc3cbdc85fb93bbac9722fc6e6e767da08 /bin/bash
There are many other ways to handle this, but it really depends on your ultimate goal. Have fun exploring docker!
Best of luck