How can I copy files to a docker container when error happened:Nosuch container?

Viewed 3870

I am new about docker, so ,if any wrong thoughts come from me ,please point out it.Thanks~

I aim at running a web server that was developed by me ,or a team I belong to,in the docker.

So, I thought out three steps:

Have a image ,copy the web files into it,and run the container.so,I do the step below:

1- get a docker image.

I try like this : docker pull centos, so that I can get a image based on centos.Here, I did not care about the version of centos,of course, it's version is 6.7 or ,just taged:latest.

Here,I check the image by docker images,and I can see it like this:

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
docker.io/centos    latest              d123f4e55e12        3 weeks ago         196.6 MB

So,I think this step successed.

2- try copying the files in local system to the container.

I stop at the path: /tornado,which had a folder named fordocker .The

fordocker contains the web-server files.

I try commonds like this(based on the guide):

docker cp fordocker/ d123f4e55e12:/web

But! Here comes the error:

Error response from daemon: No such container: d123f4e55e12

3- if I copy the files successfully,I could try like this:docker run -d centos xxx python web.py.

This step will come error?I don't know yet.

I searched a lot ,but do not explain the phenomenon.

It seemed that everyone,beside me ,use the commond would succes.

So,here comes the questions:

1- Is the method I thought out feasible? Must I create a images through profile?

2- Where comes the error if the method is feasible? Did the commond cp based on otherthings that I had not done?

3- What should I do if the method is not feasible?Create a image myself?

Have a good day~

2 Answers
Related