“How to Install Docker” “Compose on Ubuntu 20.04”

“How to Install Docker” “Compose on Ubuntu 20.04”
We hope this post helped you to find out “How to Install Docker” “Compose on Ubuntu 20.04”
Reading full article here https://www.mstvlife.com/how-to-install-docker-compose-on-ubuntu-20-04/
Docker Compose is a command-line device that means that you can outline and orchestrate multi-container Docker functions. It makes use of a YAML file to configure the appliance’s companies, networks, and volumes.
With Compose, you may outline a transportable utility setting you could run on any system. Compose environments are remoted from one another, permitting you to run a number of copies of the identical setting on a single host.
Compose is usually used for native growth, single host utility deployments, and automatic testing.
This text explains how you can set up the most recent model of Docker Compose on Ubuntu 20.04. We’ll additionally discover the essential Docker Compose ideas and instructions.
Stipulations #
We’re assuming that you’ve Docker put in in your Ubuntu machine.
Installing in Docker Compose on Ubuntu #
Docker Compose is a single binary file. The set up is simple. We’ll obtain the file to a listing that’s within the system PATH and make it executable.
The Docker Compose package deal is accessible within the official Ubuntu 20.04 repositories, however it could not at all times be the most recent model.
On the time of writing this text, the most recent secure model of Docker Compose is 1.25.5
. Earlier than downloading the Compose binary, go to the Compose repository release page on GitHub and verify if there’s a new model accessible for obtain.
Use curl
to download the Compose file into the /usr/local/bin
directory:
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Once the download is complete, apply executable permissions to the file:
sudo chmod +x /usr/local/bin/docker-compose
To verify that the installation was successful, run the following command which will print the Compose version:
docker-compose --version
The output will look something like this:
docker-compose version 1.25.5, build b02f1306
That’s it! Docker Compose has been put in in your Ubuntu machine, and you can begin utilizing it.
Reading full article here https://www.mstvlife.com/how-to-install-docker-compose-on-ubuntu-20-04/
Getting Began with Docker Compose #
On this part, we’ll use Docker Compose to construct a multi-container WordPress utility
Step one is to create a undertaking listing:
mkdir my_appcd my_app
Open your text editor and create a file called docker-compose.yml
inside the project directory:
nano docker-compose.yml
Paste the following content:
docker-compose.ymlversion: '3'services:
db:
image: mysql:5.7
restart: always
volumes:
- db_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress wordpress:
image: wordpress
restart: always
volumes:
- ./wp_data:/var/www/html
ports:
- "8080:80"
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: password
depends_on:
- dbvolumes:
db_data:
wp_data:
Let’s analyze the construction of the docker-compose.yml
file.
The primary line of the file specifies the model of the Compose file. There are a number of completely different variations of the Compose file format with assist for particular Docker releases.
Subsequent, you outline companies, volumes and networks.
On this instance, we’ve got companies, db
, and wordpress
. Every service runs one picture, and creates a separate container when docker-compose is run.
Companies can use photographs which might be accessible on DockerHub or photographs constructed from the Dockerfile. The service part additionally contains keys specifying uncovered ports, volumes, setting variables, dependencies, and different Docker instructions
Reading full article here https://www.mstvlife.com/how-to-install-docker-compose-on-ubuntu-20-04/
From the undertaking listing, begin up the WordPress utility by operating the next command:
Conclusion #
We’ve proven you how you can set up Docker Compose on Ubuntu 20.04. Utilizing Docker Compose can considerably enhance your workflow and productiveness. You possibly can outline your growth setting with Docker Compose and share it with the undertaking collaborators.
We hope the “How to Install Docker” “Compose on Ubuntu 20.04” help you. If you have any query regarding “How to Install Docker” “Compose on Ubuntu 20.04” drop a comment below and we will get back to you at the earliest.
We hope this post helped you to find out “How to Install Docker” “Compose on Ubuntu 20.04” . You may also want to see — How to Upgrade to Ubuntu 20.04