□ gforghetti: $ docker container run -it -name my-app1 -volume my_binary_data:/home/dev/tmp alpine:latest sh Run a container and do a bind mount to the volume and bring up a shell inside the container. "Mountpoint": "/var/lib/docker/volumes/my_binary_data/_data", □ gforghetti: $ docker volume inspect my_binary_data The containers have to run on the same Docker node.Ĭreate a docker volume □ gforghetti: $ docker volume create my_binary_dataĭisplay the volume information □ gforghetti: $ docker volume ls Well without more details, here is how I would do it. You need to consider that in the virtual world that virtual machines, containers and applications all have failures, go down, require “maintenance”, new versions, etc etc. What happens to containers running Docker Image 2 and Docker Image 3 if they cannot access the binary data from the container running Docker Image 1? Can those applications “recover/retry”? How often will you need to rebuild the Docker Image 1 to create the /home/dev/tmp directory and put new binary data in it? Several times a day? Daily? Weekly? Once in a while? Rarely? None, it’s a one time thing? When you run containers from these images and wish to access the binary data created by the container started from Docker Image 1, will these 2 containers be updating the binary data in the /home/dev/tmp directory running in the container started from * Docker Image 1, or will these 2 containers just read the binary data? Questions about Docker Image 2 and Docker Image 3 –What happens if this container crashes or the docker node crashes, do you need to recreate the data? Or can you just start a new container from this docker image. –Do you need to backup this data in case the container crashes or the docker nodes crashes? –Is this data sensitive, does it need to be encrypted, protected? –When you run a container from this docker image, will the binary data be changed in the the /home/dev/tmp directory by this container? –Does this image contain an application which will run when you run a container from this docker image? –Is the contents of the /home/dev/tmp directory code or data? You build this docker image and during the build you create the /home/dev/tmp directory and put binary data in that directory. So you will have 3 docker images and wish to run 3 containers (one from each image).ĭocker image 1 (this one contains your binary data) Secure Postgres Docker database against unauthorized access.How to purge Docker images, containers, networks or volumes.Scale Docker containers using docker-compose.Integrate TICK into your application using Apache.Recommended books to expand your Docker knowledge: You should take into account that if the content of a container will never change probably is better to copy content once you are building its Docker image.įinally, if you need to provide changes to a container that has no volumes attached with it and it is not possible to recreate it, there is always the option of copy files directly to a running container. One of the main benefits of using Docker volumes is the ability of changing the content/configuration of a container without the need of recreating it. If you need to delete them, you can use the following post to delete the existing Docker volumes running in your system. If you followed this tutorial you might have lots of Docker populated volumes. Version '3' volumes : web_data : external : true services : app : image : nginx:alpine ports : - 80:80 volumes : - web_data:/usr/share/nginx/html:ro app2 : image : nginx:alpine ports : - 8080:80 volumes : - web_data:/usr/share/nginx/html:ro Remove Docker volumes
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |