Setup Docker + Compose on Debian/Ubuntu
Docker gives you sand boxing for your apps by isolating them from your main system files with very little overhead.
Compose lets you define a set of instructions for multiple containers in a single stack.
Getting Started
1. Install Docker + Compose
Copy and paste these lines and you're good to go!
sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl gnupg software-properties-common
curl -fsSL https://download.docker.com/linux/$(lsb_release -is | awk '{print tolower($0)}')/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/$(lsb_release -is | awk '{print tolower($0)}') $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin2. Run Docker commands without sudo
Add the current user to the docker group and relog to take effect.
sudo usermod -aG docker ${USER}
su - ${USER}Try it out
Run an example container and see if things are working.
docker compose version
docker run hello-worldWhat Now?
Containerize your existing apps or check out this library of free and open source software. Read my next article on setting up a reverse proxy so all your apps can be hosted under one domain!