What is Docker?
Docker is a software platform that allows you to quickly build, test, and deploy applications. Docker packages software into standardized units called containers that include everything needed for the software to run, including libraries, system tools, code, and runtime.
Advantages of using Docker
Portability, you only have to program the application once.
Greater consistency is achieved between test environments and production environments.
Greater modularity and security are obtained.
Docker instances are lighter.
Containers are free and open source.
Containers VS. Virtual machines
The functional difference of how containers work with respect to how a virtual machine works, the graph on the right shown below shows how a virtual machine works.
Installing Docker and Docker-compose
- Para máquinas Linux Ubuntu:
https://docs.docker.com/engine/install/ubuntu/
- Para máquinas Linux Fedora:
https://docs.docker.com/engine/install/fedora/
- Docker Compose:
https://docs.docker.com/compose/install/
Important: sudo usermod -aG docker {user}
Installing Docker and Docker-compose
For Mac computers, go to https://docs.docker.com/desktop/mac/install/ to download the installer.
Assembly of an existing project.
- cd ~/projects
- mkdir taller
- cd taller
- wget https://github.com/wodby/docker4drupal/releases/download/5.4.9/docker4drupal.tar.gz
- tar -xvzf docker4drupal.tar.gz
- mkdir mariadb-init
- git clone https://github.com/GustavoA-Contre/taller.git code
- cd ~/projects/workshop/code
- cd ..
- Editing the .env file
- rm docker4drupal.tar.gz
- rm docker-compose.override.yml
- rm docker-sync.yml
- Editing the docker-compose.yml file (traefik:v1.7.16-alpine)
- We locate the .sql.gz file in mariadb-init
- gunzip mariadb-init/drupal.sql.gz
- Configuring settings.local.php
- cd ~/projects/workshop/code
- mkdir tmp
- chmod -R 755 tmp
- cd ~/projects/workshop
- chown -R {usuario}:docker code
- chmod 777 -R ~/proyectos/taller/code/web/sites/default/files
- docker-compose up -d
- docker-compose exec php composer install
- docker-compose exec php drush cr
Below we share the video of the Docker workshop step by step