I'm a bit new to docker, but am searching this for quite a long time now.
I am using docker almost always with this container: https://hub.docker.com/_/wordpress/ , because most of my project are WordPress based.
The point is that every time I'm running this container, I'm running it on a localhost domain. Now at the company I'm working, we still using Virtual Machine. Here I have a 'homestead.yml' file, were I can add a custom domain and it's path. I also need to add this to my hosts file, and run a vagrant provision.
I don't want to use Virtual Machine on this Mac, because I like the speed of using Docker, but I do want the custom domains. For example; I work on a project called 'sunglasses', I want to create a local domain called 'sunglasses.local' for my local environment. But i can't seem to get it working...
My docker-compose file looks like this:
version: '3.1'
services:
wordpress:
depends_on:
- db
image: wordpress:latest
restart: unless-stopped
working_dir: /var/www/html
volumes:
- ./wp-content:/var/www/html/wp-content
# - /Users/username/dev/wordpress-foundation-boilerplate/wp-content:/var/www/html/wp-content
# - /Users/username/dev/docker-wp-demo/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
environment:
WORDPRESS_DB_NAME: database
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: p4ssw0rd!
WORDPRESS_TABLE_PREFIX: wp_
WORDPRESS_DEBUG: 1
WORDPRESS_CONFIG_EXTRA: | # Add config to wp-config.php
define('FS_METHOD', 'direct');
define('WP_DEBUG_LOG', true);
define( 'WP_DEBUG', true );
ports:
- 8000:80
- 443:443
networks:
- back
db:
image: mysql:5.7
restart: unless-stopped
volumes:
- db_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: p4ssw0rd!
networks:
- back
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
restart: always
ports:
- 8080:80
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: p4ssw0rd!
networks:
- back
networks:
back:
volumes:
db_data:
I'm using Gasmask (see: http://clockwise.ee/) for editing my hosts file, and already added the domain I want to use with the right IP-adres.
Any idea what I'm missing? I don't now were to place the domain address in my docker-compose file. I have tried added it under 'ports' but this didn't even run my docker-compose file. I hope someone knows what I'm doing wrong.