简体   繁体   中英

Copying plugins to base wordpress image, Plugins folders are visible in cmd but not visible in volume mount

Copy plugins to wordpress base image. Plugins folders are visible in cmd CMD using command docker run -it --rm arslanliaqat/testwordpressimage sh but not visible in volume mounted Folder . I have attached the screenshot of cmd commands and folder as well.

Dockerfile

FROM wordpress:php7.1-apache

WORKDIR /var/www/html

COPY plugins/wordpress-seo/ /var/www/html/wp-content/plugins/wordpress-seo/
COPY plugins/wp-super-cache/ /var/www/html/wp-content/plugins/wp-super-cache/

EXPOSE 80

Docker-compose.yml

version: '3.3'
services:
    db:
        image: 'mysql:5.7'
        volumes:
            - './dbdata:/var/lib/mysql'
        restart: always
        environment:
            #PMA_HOST: db
            #PMA_PORT: 3000   
            MYSQL_ROOT_PASSWORD: wordpress
            MYSQL_DATABASE: wordpress
            MYSQL_USER: wordpress
            MYSQL_PASSWORD: wordpress 

    wordpress:
        depends_on:
            - db
        image: 'arslanliaqat/testwordpressimage:latest'
        #image: 'wordpress:latest'
        volumes:
            #- './wordpress/:/var/www/html/'
            - './Wordpress:/var/www/html'
            #- './wordpress:/var/www/html'
            #- './wordpress/wp-content/plugins/wordpress-seo/:/wp-content/wordpress-seo/'
            #- './wordpress/wp-content/plugins/wp-super-cache/:/wp-content/wp-super-cache/'
            # - './plugins/wordpress-seo/:/var/www/html/wp-content/plugins/wordpress-seo/'
            # - './plugins/wp-super-cache/:/var/www/html/wp-content/plugins/wp-super-cache/'
            - './docker/wordpress/php/php.ini:/usr/local/etc/php/conf.d/php.ini:ro'
        ports:
            - '8000:80'
        restart: always
        environment:
            WP_LOCALE: en_US
            WORDPRESS_LOCALE: en_US
            WORDPRESS_DB_HOST: 'db:3306'
            WORDPRESS_DB_USER: wordpress
            WORDPRESS_DB_PASSWORD: wordpress
            WORDPRESS_TABLE_PREFIX: wp_
            WORDPRESS_DEBUG: 1
            WORDPRESS_DB_NAME: wordpress
            working_dir: /var/www/html

volumes:
    db_data: 
    wordpress:

Bind mounts have been around since the early days of Docker. Bind mounts have limited functionality compared to volumes. When you use a bind mount, a file or directory on the host machine is mounted into a container.

That means: when you define - './Wordpress:/var/www/html' in compose, the directory /var/www/html in container will be override by the directory ./Wordpress on host. So you can just see the contents of your hosts.

But for this , you did not use bind mount volume, so your things in container not override by host directory.

Detail refers to official guide

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