Docker Installation Steps
Install using the repository
Before you install Docker Engine - Community for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.
Step 1: Update your existing list of packages
Step 2: Next, install a few prerequisite packages which let
apt
use packages over HTTPS:$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
Step 3: Then add the GPG key for the official Docker repository to your system:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Step 4: Add the Docker repository to APT sources:
$sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs)
stable"
$sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs)
stable"
Step 5: Next, update the package database with the Docker packages from the newly added repo:
Step 6: Make sure you are about to install from the Docker repo instead of the default Ubuntu repo:
$ apt-cache policy docker-ce
You’ll see output like this, although the version number for Docker may be different:
Output:
Step 7: Notice that docker-ce is not installed, but the candidate for installation is from the Docker repository for Ubuntu 18.04
Step 8: Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:
$ sudo systemctl status docker
The output should be similar to the following, showing that the service is active and running:
Executing the Docker Command Without Sudo (Optional)
The output should be similar to the following, showing that the service is active and running:
Executing the Docker Command Without Sudo (Optional)
If you want to avoid typing sudo whenever you run the docker command, add your username name to the docker group:
To apply for the new group membership, log out of the server and back in, or type the following:
You will be prompted to enter your user’s password to continue.
Confirm that your user is now added to the docker group by typing:
$ id -nG
If you need to add a user to the docker group that you’re not logged in as, declare that username explicitly using:
$ sudo usermod -aG docker username
Eg: sudo usermod -aG docker ubuntu
Register for a Docker ID
Your Docker ID becomes your user namespace for hosted Docker services, and becomes your username on the Docker Forums.
- Go to the Docker Hub signup page.
- Enter a username that is also your Docker ID.Your Docker ID must be between 4 and 30 characters long, and can only contain numbers and lowercase letters.
- Enter a unique, valid email address.
- Enter a password between 6 and 128 characters long.
- Click Sign up.Docker sends a verification email to the address you provided.
- Click the link in the email to verify your address.
Note: You cannot log in with your Docker ID until you verify your email address.
Once Verification is done. Please try to login to Docker Hub with registered details
After successful login, click on "Create Repository"
Please provide the Repository name and other details and then click on the [Create] button
Verify the repository created successfully in Docker hub or not
To push a new tag to this repository, use the below command
docker push krishnadasari610/testrepository:tagname
No comments:
Post a Comment