-
-
Notifications
You must be signed in to change notification settings - Fork 0
Docker Local Services
Docker Local Services is a stack of containers that shared between all environments. It contains:
- Traefik - As reverse proxy and request router between containers
- Portainer - Container management system
- MailHog - An Email catcher. Emails from all containers will be delivered to the MailHog
- MariaDB - The database instance, it is shared between containers what let you use several containers at the same time.
- Adminer - A database management tool.
- SSH Agent - A ssh-agent that let you use your ssh keys in the CLI container
- Install docker and docker-compose
NOTE: On Linux you may need to add sudo
before docker commands.
For the basic usage you don't need to modify any of this configurations
- Copy folder Local_Services to your local machine
- Navigate into the directory Local_Services
- Execute
docker-compose up -d
to start containers. - Add entries to your local hosts file:
127.0.0.1 traefik.local.test
127.0.0.1 portainer.local.test
127.0.0.1 mailhog.local.test
127.0.0.1 adminer.local.test
NOTE: The hosts file location may be unique to a OS. The common hosts file path is C:\Windows\System32\drivers\etc for Windows or /etc/hosts for Linux
- Verify in browser each of the Urls above.
NOTE: At the first time when you will try to open any of urls there might be a message about invalid SSL certificate. The environment uses self-signed SSL certificate that's the reason of this message.
Service | Host | Username/Password |
---|---|---|
Traefik | https://traefik.local.test/ | N/A |
Portainer | https://portainer.local.test/ | admin/admin |
Mailhog | https://mailhog.local.test/ | N/A |
Database | 127.0.0.1:3306 | root/pass OR magento2/magento2 |
Adminer | https://adminer.local.test/ | root/pass OR magento2/magento2 |
NOTE: The Portainer may give an option to select which environment you want to use. In this case select "Docker"
When you want to update container's images run the following commands from the Local_Services directory:
docker-compose stop
docker-compose pull
docker-compose up -d
You will notice a directory mysql
with a single file custom-config.cnf
. You can add adjustments to the MariaDB default configuration to this file.
After you revised the file you need to restart containers to apply changes. From the Local_Services directory run following commands:
docker-compose stop
docker-compose up -d
An example of the database dump command for database named magento:
docker-compose exec db sh -c 'exec mysqldump -umagento -pmagento magento' > {path}/dump.sql
NOTE: You may need to change the username and password for a database. The example uses credentials from the Access Section
You can add your local ssh key with the command (from the local services directory):
docker-compose exec ssh-agent ssh-add /root/.ssh/id_rsa
Then verify that the key has been added with the command:
docker-compose exec ssh-agent ssh-add -l