This copy is stored in the file called backup.sql, which is available to you in the directory where you issued the command. The docker exec command we tried earlier makes postgres create a copy of the data in your database. For that, you do not need access to that volume. Now, your intention is to transfer your data to another machine. Since I did not specify my directory, Docker automatically created a volume for me (where it’s solely managed by Docker). mount type=bind,target=/var/lib/postgresql/data,source=/home/user1/mydata Assuming you have a directory called /home/user1/mydata, the command to create the container is something like this: docker run -d Using those is preferred.įinally, at the time of creating a container itself, you can specify the directory that you want the container to use yourself. The sudo command will run the ls command with elevated permissions, which are required to see that directory.īut as you saw with the backup method above, there are other ways to get data in and out of a docker container. If you really, really want to see that directory, use the command: sudo ls -l /var/lib/docker You are not supposed to manipulate that by hand docker makes it available to the container via a process called mounting. The path that you saw is controlled by docker itself, and is protected by permission settings. As a result of these tricks, accessing container files becomes, as I said, a little more complicated. To make this possible, docker performs all kinds of tricks. That way, two applications cannot interfere with each other’s data or settings. Docker containers are a way of running applications such that each application thinks it is running on a machine by itself. Your situation is a little more complicated than it would have been if you were using just Linux, instead of Linux and Docker.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |