skip to Main Content

I would like to create image including initial data. That is no problem. But I want to share those data (binary files) with another container and/or get those data out of the container to my local PC.

When I use volume, it will replace the folder inside container with empty one. I can mount folder "into" container but I need oposite direction – folder inside container to be visible out of docker.

Is there any option how to get data from container, other than docker cp?

2

Answers


  1. Is posible to mount data from container to other container/local PC?

    Not in the sense you are asking. You can share a volume or a mount between containers.

    how to get data from container

    docker save it and unpack.

    Start the container with just a tar command that streams the data out.

    STart a temporary contianers with sleep infinity, and like you suggested use docker cp.

    Login or Signup to reply.
  2. If its just a one time or not so frequent thing, you can copy the container data into the host machine through docker cp, and then create another container and use docker volume the next time to mount the host folder into the new container, in this case you will not have an empty folder, rather the data will be there

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search