首页 > 代码库 > [Docker] Create a Volume
[Docker] Create a Volume
We can create volumn to keep the data, even we stop the container and restart again, the data won‘t get lost.
To create a link between the folder /my-files
on your host machine and the htdocs
folder in the container. This also runs the container in the background.
docker run -d -p 80:80 -v /my-files:/usr/local/apache2/htdocs web-server:1.1
After runnning the container, Let’s see what this looks like from inside the container.
Attache a shell to the container:
docker container exec -it elegant_noether /bin/bash
cd to folder:
cd /usr/local/apache2/htdocs
Now we can use ‘ls -la‘ to see what is inside the folder.
[Docker] Create a Volume
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。