I am trying to take a docker container from one machine and run it on another and encountering this error: "Error response from daemon: No command specified".
Below is a simplified example showing the problem:
docker --version
Docker version 1.10.1, build 9e83765
docker pull ubuntu
docker run --name u1 -dit ubuntu:latest
docker export -o exported u1
docker stop u1
docker rm u1
docker import exported ubuntu:imported
docker run --name u1 -dit ubuntu:imported
docker: Error response from daemon: No command specified.
In that example, we first pull an image (ubuntu) and successfully create/run container u1
from it. Then we export that container to a file (exported
), stop/remove the container, import the file into a new image (ubuntu:imported
) and try to run a new container from it. It fails.
docker export
does not export everything about the container — just the filesystem. So, when importing the dump back into a new docker image, additional flags need to be specified to recreate the context.For example, if the original container was running fine because the Dockerfile that was used for creating its image had
CMD ["/usr/bin/supervisord"]
in it, then import your dump this way:you can use
docker load
command to load images from archive file . this command will import image file and args together.Got this error when trying to export and import docker
microsoft/mssql-server-linux
.https://hub.docker.com/r/microsoft/mssql-server-linux/
Commands to export and import:
However we could not find the command to run it. The solution was listing all containers on the exporting machine and looking at the command ran.
From there we could find out how to run the correct command:
When you export a container it lost own history which contains image layers and meta data. So your container lost its pid states.
Every container should have a initial (root) process. You are overiding the default entrypoint on the dockerfile as bash. [edited] I think even you dont override it uses default , not defined in ubuntu base image. So you should start your initial process with cmd command. I think there is no bug. It is a dockerfile feature for reusablity.
Got it working with these additional steps:
Create Dockerfile as follows:
Build new image:
Now it will run:
However, it is still unclear why simply exported and then imported image does not work right away. Is this a bug?
if using
import
if using
load