How to change the directory where my docker image is installed inside a container?

。_饼干妹妹 提交于 2020-02-25 04:14:29

问题


When i do df -h inside my container i get this

Filesystem      Size  Used Avail Use% Mounted on
overlay          30G  1.9G   28G   7% /
tmpfs            64M     0   64M   0% /dev
tmpfs           492M     0  492M   0% /sys/fs/cgroup
/dev/xvda1       30G  1.9G   28G   7% /etc/hosts
shm              64M     0   64M   0% /dev/shm
:/              8.0E   52M  8.0E   1% /var/www/html
tmpfs           492M     0  492M   0% /proc/acpi
tmpfs           492M     0  492M   0% /proc/scsi
tmpfs           492M     0  492M   0% /sys/firmware

Scenario

I am running wordpress in my container so when i install it i think it gets installed in either overlay or /dev/xvda1 which is the root volume of my ECS instance which it is running on (EBS 30gb)

Problem

What is happening is that when i terminate the ECS instance and launch a new one through autoscaling groups i lose my installation (obviously since EBS volume gets terminated)

Question

Is there any way i can change where my wordpress is installed so it persists say maybe a EFS mount

Basically i want to change the installation directory so it is not dependent on EBS but EFS

So when i run the container in any Instance that way my installation persists :)

Note

I have already mounted EFS on var/www/html so mounting EFS on container for persistant storage is not a problem i can simply mount another EFS if there is a way to change the installation directory that is where my wordpress gets installed

Any help is highly appreciated thanks :)

来源:https://stackoverflow.com/questions/60123804/how-to-change-the-directory-where-my-docker-image-is-installed-inside-a-containe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!