简体   繁体   中英

Wordpress & Docker. Trying to interact with WP Console incl updating problems

I've used Brad Traversy's YT video 'Quick Wordpress Setup With Docker' to get a WP up and running (see code below). I've got my WP site up and running but I've got WP telling me there are updates available. Currently if I try to update this is what I see in the WP console. I'm completely new to docker having previously used local by flywheel. I've tried anything I could think of for the hostname but no joy. What do I put for the hostname?

在此处输入图像描述

version: '3'
services: 
    #######  Database service  #######
    db:
        image: mysql:5.7
        volumes:
            # This gives us persistence
            - db_data:/var/lib/mysql
        # if the server reboots the container restarts
        restart: always
        # define your mysql environment variables
        environment:
            MYSQL_ROOT_PASSWORD: password
            MYSQL_DATABASE: wordpress
            MYSQL_USER: wordpress
            MYSQL_PASSWORD: wordpress
        networks:
            - wpsite
        

    #######  phpmyadmin service  #######
    phpmyadmin:
        depends_on: 
            - db
        image: phpmyadmin/phpmyadmin
        restart: always
        ports:
            - '8080:80'
        environment: 
            PMA_HOST: db
            # as above in the db service
            # your phymyadmin login is root/password
            MYSQL_ROOT_PASSWORD: password
        networks:
            - wpsite


    #######  Wordpress service  #######
    wordpress:
        depends_on:
            - db
        image: wordpress:latest
        ports:
            # local:8000, container:80
            - '8000:80'
        restart: always
        # okay so we want the WP install in the container to sync locally here
        # Mapping './' (local current folder) to '/var/www/html' (container's web root folder as we're using apache)
        volumes: ['./:/var/www/html']
        environment: 
            # the host is going to be the db service by mysql above, port 3306 is the default for mysql
            # we've already setup the DB user above
            WORDPRESS_DB_HOST: db:3306
            WORDPRESS_DB_USER: wordpress
            WORDPRESS_DB_PASSWORD: wordpress
        networks:
            - wpsite
            # map the volume of db_data (in service db above) and the network of 'wpsite'
networks: 
    wpsite:
volumes:
    db_data:

# Now go and run docker-compose up -d

when you are using docker compose, the apps do not understand the localhost address.

in which container is the ftp service running?

for example, if the ftp is running on the wordpress container, you need to connect to wordpress instead of localhost because wordpress is the name of your service

but, if you ftp is hosted in your host, check this answer How to access host port from docker container

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