Install Docker & docker-compose on Ubuntu 20.04

Install with one command: curl -sL https://magenaut.com/getdocker | bash Or follow the below steps. 1. Install Docker on Ubuntu 20.04 sudo apt-get update sudo apt install docker.io sudo systemctl enable –now docker sudo usermod -aG docker $USER newgrp docker 2. Install docker-compose on Ubuntu 20.04 sudo apt-get install curl sudo curl -L “https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)” … Read more

Environment variables from docker-compose .env to Dockerfile

1. Declare the variables in .env PHPFPM_IMAGE=php:7.2-fpm USER_ID=1000 2. Pass the variables to Dockerfile using args in docker-compose.yml version: '3' services: app: build: context: . dockerfile: Dockerfile args: PHPFPM_IMAGE: ${PHPFPM_IMAGE} USER_ID: ${USER_ID} 3. Use the keyword ARG to receive the variables in Dockerfile # ARG to use WITH "FROM" ARG PHPFPM_IMAGE FROM $PHPFPM_IMAGE # ARG … Read more