This tutorial explains, how to install docker on Ubuntu.
Docker is a platform that combines applications and its dependencies in the form of packages called a container. We can run multiple containers on a single Operating System. Containers are not Virtual Machines. Virtual Machines requires Operating System to run applications, but containers do not. As containers don’t need an Operating System, it takes very little time to start and hence it is very faster than Virtual Machines.
Read About: How to Install Docker on Windows
To install Docker on Ubuntu, you obviously need to have Ubuntu 18.04 with internet access, and you need to be a “ sudo user ”. To update and upgrade the local database before installation, execute the following command to update the existing list of packages. Sudo apt update. Sudo apt upgrade. Apr 09, 2021 Ubuntu 20.04 installed dedicated server or KVM VPS. A root user access or normal user with administrative privileges. Add A record of your preferred domain like port.example.com; Install Portainer on Ubuntu 20.04 with Docker 1. Keep server updated. Always keep your server up-to-date for security purpose. # apt-get update -y. Oct 03, 2021 This tutorial covers how to install Docker on an Ubuntu 20.04 machine. Docker is an open-source containerization platform that allows you to quickly build, test, and deploy applications as portable containers that can run virtually anywhere. Ubuntu is a Debian-based Linux operating system based on free software. Install the latest Docker Compose on Ubuntu using PIP Install Sudo Ubuntu Docker Windows 7. PIP stands for 'PIP Installs Package'. It's a command-line based package manager for installing Python applications. Since Docker Compose is basically a Python program, you can use PIP to install it. But before you do that, you need to install PIP on. Step 1) Install prerequisites packages for docker. Login to Ubuntu 20.04 /20.10 system and run the following apt commands to install docker dependencies, $ sudo apt update $ sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common.
&& How to install Ansible on Ubuntu
Install Docker on Ubuntu
Step 1- Update your Ubuntu Linux Box.
$ sudo apt-get update -y
Step 2 – Download and run a get-docker.sh script to install docker.
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
or you can Download and run Test Script.
Download and run testing version, download and install test-docker.sh script using the following commands.
$ curl -fsSL https://get.docker.com -o test-docker.sh
$ sudo sh test-docker.sh
Step 3- Add a user to the Docker group.
If you would like to use Docker with a non-root user, using the following command.
Add a new user docker-user and set a password
$ sudo useradd docker-user
$ sudo passwd docker-user
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Add docker-user to Docker group
$ sudo usermod -aG docker docker-user
Step 4 – Check Docker Version
Check Docker Version using the following command
$ docker – -version
Docker version 19.03.8, build afacb8b7f0
Uninstall Docker on Ubuntu
Use the following command to uninstall docker completely, including Docker Engine, CLI and Containerd Package
$ sudo apt-get purge docker-ce docker-ce-cli containerd.io -y
Also delete all Docker Images, Containers, and Volumes that not automatically remove.
$ sudo rm -rf /var/lib/docker
Note: If you install docker using the script, you should update the docker using the package manager only. Don’t re-run docker script, as it can cause issues if it attempts to re-add repositories.
I hope you enjoyed this tutorial and learned about “How to install Docker on Ubuntu using Script”. If you think this is really helpful, please do share this article with others as well. Please also share your valuable feedback, comment, or any query in the comment box. I will really happy to resolve your all queries any.
If you think we helped you or just want to support us, please consider these:-
Connect to us: FacebookTwitter
In this article, we’ll explain how to install Portainer on Ubuntu 20.04 with Docker.
Portainer is powerful, open-source toolset that allows you to easily build and manage containers in Docker, Swarm, Kubernetes and Azure ACI. It works by hiding the complexity that makes managing containers hard, behind an easy to use GUI.
- Ubuntu 20.04 installed dedicated server or KVM VPS.
- A root user access or normal user with administrative privileges.
- Add A record of your preferred domain like port.example.com
Install Portainer on Ubuntu 20.04 with Docker
1. Keep server updated
Always keep your server up-to-date for security purpose.
# apt-get update -y
2. Install Docker
Install the required dependencies for Docker:
# apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
Add the Docker CPG Key
Install Docker In Ubuntu Wsl
# curl -fsSL https://download.docker.com/linux/ubuntu/gpg sudo apt-key add -
Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.
# sudo apt-key fingerprint 0EBFCD88
pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) <[email protected]>
sub rsa4096 2017-02-22 [S]
Add the Docker Repository
# add-apt-repository 'deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable'
The following command will download Docker and install it:
# apt-get update -y
# apt-get install docker-ce -y
Start and enable Docker service
# systemctl start docker && systemctl enable docker
3. Create a container
We’ll show you two ways to deploy the container.
1. If you want to use domain name to access Portainer, use following command to deploy the container:
# docker run --restart always -d --name=portainer -v /var/run/docker.sock:/var/run/docker.sock -v /vol/portainer/data:/data -e VIRTUAL_HOST=port.example.com -e VIRTUAL_PORT=9000 portainer/portainer-ce -H unix:///var/run/docker.sock
- -v /var/run/docker.sock:/var/run/docker.sock means mounting /var/run/docker.sock to the container so portainer can control the Docker.
- -v /vol/portainer/data:/data means storing data of portainer on directory /vol/portainer/data.
- port.example.com is your domain to access the portainer.
2. If you want to access Portainer using server IP, use following command to deploy the container:
# docker volume create portainer_data
# docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
4. Configure Reverse Proxy for Portainer (Optional if you will use domain name)
Caddyfile is a reverse proxy server. It is necessary to secure the connection to prevent network hijacking. Caddyfile can obtains and automatically maintains SSL certificate.
Create a Caddyfile. Caddyfile is a document containing configs for your sites:
# mkdir -p /vol/caddy/configs
# vi /vol/caddy/configs/Caddyfile
Add following content:
tls [email protected]
Replace: port.example.com with your domain name and [email protected] with your actual email id.
Save and exit.
Finally, create a Caddy container using following command:
# docker run --restart always -d -p 80:80 -p 443:443 -v '/vol/caddy/data:/data/caddy' -v '/vol/caddy/configs:/etc/caddy' --link portainer --name caddy caddy
- -p 80:80 -p 443:443 means publish its 80 and 443 port to your host so you can access it with those ports.
- -v '/vol/caddy/data:/data/caddy' means mount caddy working directory to your host to persist data such as certificates.
- -v '/vol/caddy/configs:/etc/caddy' means mount caddy configuration directory to your host to persist configurations.
- --link portainer means link container caddy with portainer so they can access with each other.
5. Access Portainer
Docker Install On Ubuntu 18
Navigate to your browser and access the Portainer by using either your domain or server IP and set admin password and finish the installment.
Docker Install In Ubuntu Software
That’s it. The installation has been completed successfully.
In this article, we’ve have seen how to install Portainer on Ubuntu 20.04 with Docker.