Thursday, December 13, 2018

thumbnail

Install and Configure Docker with Portainer on Ubuntu


About


Docker is an open-source application build and deployment tool. It is based on the idea of that you can package your code with dependencies into a deployable unit called a container.

Portainer is an open-source management UI for Docker, including Docker Swarm environment. Portainer makes it easier for you to manage your Docker containers, it allows you to manage containers, images, networks, and volumes from the web-based Portainer dashboard.

Here I will show you how to install and configure docker with portainer on an ubuntu machine.


Update the apt package index:
 apt-get update 

Install packages to allow apt to use a repository over HTTPS:
 sudo apt-get install \
 apt-transport-https \
 ca-certificates \
 curl \
 software-properties-common 

Add Docker’s official GPG key:
 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.
 apt-key fingerprint 0EBFCD88 
 pub   4096R/0EBFCD88 2017-02-22
 Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
 uid                  Docker Release (CE deb) 
 sub   4096R/F273FCD8 2017-02-22 

Use the following command to set up the stable repository.
 add-apt-repository \
 "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
 $(lsb_release -cs) \
 stable" 

Update the apt package index.
 apt-get update 

Install the latest version of Docker CE, or go to the next step to install a specific version:
 apt-get install docker-ce 

Verify that Docker CE is installed correctly by running the hello-world image.
 docker run hello-world 
 Unable to find image 'hello-world:latest' locally
 latest: Pulling from library/hello-world
 d1725b59e92d: Pull complete 
 Digest: sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788
 Status: Downloaded newer image for hello-world:latest 

 Hello from Docker!
 This message shows that your installation appears to be working correctly. 

After installing Docker, run the following command to pull the latest Portainer image:
 docker pull portainer/portainer 
 Using default tag: latest
 latest: Pulling from portainer/portainer
 d1e017099d17: Pull complete 
 8f8668d9390b: Pull complete 
 Digest: sha256:339b6486297050179418c886272f3262794b54513008a7f8e747c5e8f330338d
 Status: Downloaded newer image for portainer/portainer:latest 

We can see the downloaded the image using docker images command,
 docker images 
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
portainer/portainer   latest              a01958db7424        28 hours ago        72.2MB
hello-world           latest              4ab4c602aa5e        3 months ago        1.84kB

We have now Portainer in our local Ubuntu system. Let us start the container using command:
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer

output will be something like below:
a85edbd40ffaa0392542a27ddbfd6ec8c52270fe69a41e6b4c7d1bf98c4164f2 

Great, successfully launched the Portainer container. Now let access Portainer webUI using http://localhost:9000/ or http://IP_Address:9000/ URL.
You will be presented with a screen that asks to set a password for the admin user.

Create new password and hit 'Create user' button to create the admin user password.
Next screen ask us which docker environment we want to manage with docker. As we are using portainer to manage local docker environment select Local option and click Connect button.

Once connected, you will be presented with a dashboard like below.

Click on local and it will bring you to local docker environment.

Click on the App Templates button on the left. This will show some ready-made available templates such as Nginx, Httpd, MySQl, redis, Jenkins and few more.

Subscribe by Email

Follow Updates Articles from This Blog via Email

No Comments

Search This Blog

Powered by Blogger.