简体   繁体   中英

Force Docker to mount code volume in the host not the guest

I have been using the official wordpress docker repository to create a wordpress website. Now, since the code (wordpress) in this image is inside the container, I would like to extract the code out in the host.

I am using docker compose and I added:

  volumes:
    - ./code:/var/www/html

in order to force Docker work on an external directory. I got this error message:

WARNING: Service "wordpress" is using volume "/var/www/html" from the previous container. Host mapping "/dir/code" has no effect. Remove the existing containers (with docker-compose rm wordpress ) to use the host volume mapping.

阅读错误信息和

docker-compose rm wordpress

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM