Docker and Docker Compose on Ubuntu |Video upload date:  · Duration: PT5M25S  · Language: EN

Quick guide to install configure and use Docker and Docker Compose on Ubuntu for local container development and basic deployments

If you like small isolated environments that do what you tell them and then quietly resent you later this guide is for you. We will install Docker Engine enable the service fix permissions install Docker Compose run a quick test and bring up a tiny multi container app for local development and simple deployments. No mysticism required just a little terminal abuse.

Install Docker Engine

First update packages and install the distro build of Docker. Yes this is boring but it is the scaffolding for all future container chaos.

sudo apt update && sudo apt install -y docker.io

That will put the Docker daemon on your machine. Next make it start on boot and make life easier by avoiding sudo for every command.

Enable the service and adjust permissions

sudo systemctl enable --now docker
sudo usermod -aG docker $USER

After adding yourself to the docker group log out and back in so the new group membership takes effect. If you do not log out you will be treated like a guest for a while and that is the worst.

Install Docker Compose

For simple multi container setups install the compose tool from the package manager. This is fine for local dev and quick prototypes. If you want newer features consider the official Compose plugin from Docker later.

sudo apt install -y docker-compose

Run a quick test container

Make sure the engine answers when you poke it. The classic hello world image is still the least annoying smoke test.

docker run --rm hello-world

If the container prints a friendly message your installation is basically functional. If it yells at you read the logs and then blame the internet.

Bring up a multi container app with Compose

Create a compose file describing a web service and a database and then start both with one command. Compose will wire up networking and lifecycle so you can focus on the code that actually breaks later.

  • Create a file named docker-compose.yml in your project root with the services you need.
  • Start everything with a single command.
docker-compose up -d

Compose will pull images if needed create a network and run your containers in the background. Use docker-compose logs to inspect output and docker-compose down to stop everything.

Troubleshooting tips and production note

  • If commands still require sudo double check your group membership and that you actually logged out and back in.
  • If you need newer Docker or Compose versions for production use add the official Docker repository and follow the vendor instructions. The distro packages are convenient but not always the freshest.
  • Keep an eye on storage. Containers and images can quietly hog disk space and then ruin your day.

There you go. You installed Docker enabled the service fixed permissions installed Compose tested the engine and ran a multi container app with Compose. Now go write something containerized and blame the tools when it fails in production.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.