1

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?

enter image description here

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
user6746919
  • 67
  • 1
  • 9

1 Answers1

0

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

Sergio Tanaka
  • 1,325
  • 1
  • 6
  • 18
  • I know nothing about an FTP running, what's been configured is what I posted in the docker-compose.yaml file above. TBH this is a bit over my head what your asking. When you say I need to connect to wordpress instead of localhost does this mean I need to put 'wordpress' in the hostname box? But if as you say something is missing i.e. ftp then nothings going to work. Find it hard to believe he'd have left this out in his video. – user6746919 Jul 16 '20 at 16:36