Home>
Can

docker pull the same container multiple times?

If that is not the case, I've been hittingdocker pullfor a while, but I didn't seem to be able to do it all at once, so I asked a question.
What I did is the following command.

$docker pull centos: centos7
centos7: Pulling from library/centos
Digest: sha ???: ??????????????????????????????????????????? ???????
Status: Image is up to date for centos: centos7

or more will result in an error.
* The part of "?" Is hidden as a precaution because I thought it was personal information or a pass.
I want to pull centos7 in the same docker.
But it already exists.

$docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
centos centos7 hour ????????????

I would like a professor who knows it!

  • Answer # 1

      Can

    docker pull the same container multiple times?

    Pull is aimage, not a container. Sopullitself is not possible.
    You may not understand this area well.

    The container indicates the state of execution, so I think it is better to distinguish this area.
    You can start multiple containers, such as starting centos7_1 and centos7_2 containers from the centos7 image. You don't need to have multiple images if they are the same because the image is the original.


    Appendix

    If you don't understandimageandcontainer
    The real question is, can't I run multiplecontainers?

    docker run -dit --name centos7_1 centos: 7
    docker run -dit --name centos7_2 centos: 7

    You can start multiple containers by using

    .

    The list of containers isdocker ps -a
    The image list will bedocker images.

    Commands that enter the container can be entered in the container withdocker exec -it centos7_1/bin/bash(There is also a command called attach, but the exec

    To stop the container,docker rm -f centos7_1.

  • Answer # 2

      Can

    docker pull the same image multiple times?

    You cannot pull multiple identical images with the same

    tag.
    There is no need to do that.

    If the tag is different, drop it.
    For example,

    docker pull centos: 7
    docker pull centos: 6

    I have done these now.
    After that, the result confirmed bydocker imagesis as follows.

    docker images
    REPOSITORY TAG IMAGE ID CREATED SIZE
    centos 6 b5e5ffb5cdea 2 weeks ago 194MB
    centos 7 5182e96772bf 2 weeks ago 200MB

    I feel like reading a question. I thinkimageis confused withcontainer.
    These are completely different things.

    https://fa-works.com/blog/visualizing-docker-containers-and-images

  • Answer # 3

    Images are like masters, so one is enough if they are the same is.

    If you change the image save path, you may be able to pull again.

    https://qiita.com/RyoMa_0923/items/e1174b2951411ddd1d08