IT/Software/Docker

From msgwiki
< IT‎ | Software
Revision as of 09:45, 18 August 2022 by Walttheboss (talk | contribs) (Created page with "Install docker and docker-compose: If you always want to automatically get the latest version of Docker on Ubuntu, you must add its official repository to Ubuntu system. To...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Access restrictions were established for this page. If you see this message, you have no access to this page.

Install docker and docker-compose:

If you always want to automatically get the latest version of Docker on Ubuntu, you must add its official repository to Ubuntu system. To do that, run the commands below to install prerequisite packages: sudo apt update sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

Next, run the commands below to download and install Docker’s official GPG key. The key is used to validate packages installed from Docker’s repository making sure they’re trusted. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo apt-key fingerprint 0EBFCD88

Now that the official GPG key is installed, run the commands below to add its stable repository to Ubuntu. To add the nightly or test repository, add the word nightly or test (or both) after the word stable in the commands below. sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" After this command, Docker’s official GPG and repository should be installed on Ubuntu. If you have older versions of Docker, run the commands below to remove them: sudo apt-get remove docker docker-engine docker.io containerd runc

When you have removed all the previous versions of Docker, run the commands below to install the latest and current stable version of Docker: sudo apt-get install docker-ce docker-ce-cli containerd.io

This will install Docker software on Ubuntu.

Add your account, for most cases it will be ubuntu, to Docker group and restart: sudo usermod -aG docker $USER

Reboot your instance: sudo reboot

To verify that Docker CE is installed correctly you can run the hello-world image: sudo docker run hello-world

If Docker is installed correctly you will see the following response: Response: Hello from Docker! This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.

Then you need to install docker-compose. This makes it easier for you to install containers on docker. To install it, run the commands below to download version 1.26.0. As of this writing, this was the current version. sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

After downloading it, run the commands below to apply executable permissions to the binary file and create a symbolic link to /usr/binary sudo chmod +x /usr/local/bin/docker-compose sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Now, Docker Compose should work. To test it, we will run the command below: docker-compose --version

You should see similar output as below: Response: docker-compose version 1.24.0, build 0aa59064


Source: https://docs.fuga.cloud/how-to-install-portainer-docker-ui-manager-on-ubuntu-20.04-18.04-16.04