Docker Compose is a tool that lets you define and run multi-container Docker applications using a single YAML configuration file. Instead of managing containers one at a time with separate docker commands, you describe your entire application stack — services, networks, volumes, and environment variables, in one file and bring everything up with one command.
You can commit this file to version control and share it with your team. Anyone with Docker and Compose installed can spin up the exact same environment instantly. Compose is most commonly used for local development, automated testing pipelines, and single-host deployments.
Prerequisites: You need sudo access and Docker already installed on your Ubuntu machine.
The Docker Compose package in Ubuntu’s default repositories may not always be the latest version. Install directly from Docker’s GitHub releases instead.
Download the latest stable release — check the Compose releases page to confirm the current version before running this command:
bashsudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Make the binary executable:
bashsudo chmod +x /usr/local/bin/docker-compose
Verify the installation:
bashdocker-compose --version
This example sets up a two-container WordPress application — a MySQL database and a WordPress web server — using a single Compose file.
Create a project directory and navigate into it:
bashmkdir my_appcd my_app
Create a docker-compose.yml file with the following content:
yamlversion: '3.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:
Here is what this configuration defines:
mysql:5.7 image, creates a named volume db_data to persist the database across restarts, and sets the required MySQL environment variablesdepends_on to ensure the database starts before WordPressdb_data and wp_data so data is not lost when containers restartStart the application:
bashdocker-compose up
To run Compose in the background without blocking your terminal, use detached mode:
bashdocker-compose up -d
Once running, open http://localhost:8080 in a browser to see the WordPress installation screen. This confirms both containers are up and communicating correctly. Check the status of your services with:
bashdocker-compose ps
To stop services without removing the containers:
bashdocker-compose stop
To stop and remove the containers entirely:
bashdocker-compose down
To also delete the named data volumes — this permanently removes your database and stored files:
bashdocker-compose down --volumes
Uninstall Docker Compose
To remove Compose from your system, delete the binary:
bashsudo rm /usr/local/bin/docker-compose
Docker Compose is now installed on your Ubuntu 18.04 machine. With a single YAML file, you can define, start, and manage complex multi-container applications that would otherwise require many individual Docker commands. Leave a comment below if you run into any issues during setup.
PHP 8.5 is included in Ubuntu 26.04's default repositories and is the recommended version for…
Ubuntu 26.04 LTS "Resolute Raccoon" arrived on April 23, 2026 with Linux kernel 7.0, GNOME 50,…
Kubernetes is the standard platform for running containerized workloads across multiple servers with self-healing, rolling…
Ubuntu 26.04 LTS "Resolute Raccoon" was released on April 23, 2026 with Linux kernel 7.0, GNOME desktop, and standard security support until April 2031. A clean install gives you a known-good starting point on new hardware, when replacing another operating system, or when an upgrade path is not practical. This guide walks through how to install Ubuntu 26.04: downloading and verifying the ISO, writing a bootable USB drive, completing the installer, and doing the initial setup after the first boot. Before you start: You need a USB drive with at least 12 GB of free space. Back up any existing data on the target machine — the installer can erase the entire disk. Install Ubuntu 26.04: Download the ISO…
The correct timezone affects more than the clock on your screen. It drives cron job scheduling, systemd timer execution, log file timestamps, database record timing, and SSL certificate validity checks. A mismatched timezone can cause scheduled jobs to fire at the wrong hour and make log timestamps impossible to match with real-world events. This guide shows how to change timezone on Ubuntu using the timedatectl command (the recommended approach for servers and remote machines) and through the graphical Date & Time settings on desktop systems. The steps apply to all current Ubuntu releases including 24.04 and 26.04. <strong>Prerequisite:</strong> Only the root user or a user with sudo access can change the system timezone. Check the Current Timezone Before You Change It Run timedatectl with no arguments to see the active timezone and clock status: bashtimedatectl Sample output: Local…
Atom is a free, open-source, cross-platform code editor developed by GitHub. Built on Electron, it uses…