21 machine? Let’s break it down, step by step, and make this whole thing super easy.
First things first, let’s make sure our system is up to date:
Open your terminal (you know, that black window that looks a little intimidating but is actually pretty cool) and type in these commands:
bash
sudo apt-get update
sudo apt-get upgrade
These commands will update your package lists and install any available upgrades, so we’re all set for the Docker installation.
Now, let’s add the Docker repository:
We need to tell our system where to find the Docker packages, so we’ll add the official Docker repository. Here’s how you do it:
bash
sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 0EBFCD88
sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”
Don’t worry if you’re not familiar with all these commands. Just copy and paste them into your terminal.
The next step is installing Docker Engine itself:
Use this command:
bash
sudo apt-get install docker-ce docker-ce-cli containerd.io
This will install Docker Engine, the command-line interface (CLI), and containerd, which is the runtime for containers.
To verify everything’s in place, try these commands:
bash
sudo systemctl status docker
sudo docker version
If you see output similar to this:
● docker.service – Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2023-09-29 15:39:04 EDT; 2min 25s ago
Main PID: 1100 (dockerd)
CGroup: /system.slice/docker.service
└─1100 /usr/bin/dockerd -H fd:// –containerd=/run/containerd/containerd.sock
Sep 29 15:39:04 mint-21 systemd[1]: Started Docker Application Container Engine.
And this:
Client: Docker Engine – Community
Server: Docker Engine – Community
Engine:
Version: 20.10.14
API version: 1.41
Go version: go1.17.15
Git commit: 4810429
Built: Thu Aug 18 18:28:48 2022
OS/Arch: linux/amd64
Experimental: false
Then you’re good to go!
Let’s make things easier with Docker Compose:
Docker Compose lets you manage multiple containers as a single unit, making your workflow much smoother. Here’s how to install it:
bash
sudo apt-get install docker-compose
And just like before, check if it’s installed correctly:
bash
docker-compose –version
You’ll see something like this:
docker-compose version 2.10.2, build 6039574
Now, to make Docker work seamlessly, we need to add your user to the docker group:
bash
sudo usermod -aG docker $USER
Finally, restart your system:
This step ensures everything is properly set up and ready to roll.
That’s it! Now, you’re all set to start using Docker on your Linux Mint 21 machine.
Here’s a quick summary of what we did:
Step | Description |
---|---|
1 | Update the system |
2 | Add the Docker repository |
3 | Install Docker Engine, containerd, and Docker Compose |
4 | Verify Docker Engine and Docker Compose installation |
5 | Add your user to the docker group |
6 | Restart your system |
Now, let’s explore what you can do with Docker:
1. Run a simple container: docker run hello-world
2. Build your own container: docker build -t my-app .
3. Run a web server in a container: docker run -d -p 80:80 nginx
Remember, Docker is a powerful tool, and there’s a whole world of possibilities to explore. Feel free to experiment, share your findings, and don’t hesitate to ask if you have any questions!