Skip to main content

Managing Docker with Portainer

Hands-On Lab

 

Photo of Travis Thomsen

Travis Thomsen

Course Development Director in Content

Length

00:30:00

Difficulty

Intermediate

You manage containers for clients on several Docker servers. But managing the hosts has become a bit of a pain. Looking for an all-in-one tool you discover Portainer, and decide to test it out by deploying it to one of your hosts.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Managing Docker with Portainer

The Scenario

We manage containers for clients on several Docker servers. But managing the hosts has become a bit of a pain, so we've been looking for an all-in-one tool. We discovered Portainer, and have decided to test it out by deploying it to one of our hosts.

Log In

Log in to the environment using the credentials provided on the lab page, either in a terminal session on your local machine or by clicking Instant Terminal.

Create a Volume

[cloud_user@host]$ docker volume create portainer_data

Create Portainer

[cloud_user@host]$ docker container run -d --name portainer -p 8080:9000 
--restart=always 
-v /var/run/docker.sock:/var/run/docker.sock 
-v portainer_data:/data portainer/portainer

We can run docker container ls to make sure it's running.

Log into Portainer and Create a Container

Portainer is running at our lab's IP address on port 8080, so head there in a browser (http://<LAB_IP>:8080).

Create your user account and password, and on the next screen click on Local, then Connect. Click on the local in this screen, then Container in the next one.

Now we can click the Add container button. In the form that follows, use these settings:

  • Name: lab_nginx
  • Image nginx:latest

Click the map additional port button, then map port 8081 to 80 on the container. Now click Deploy the container.

Test Things

If everything is working, we should be able to look at http://<LAB_IP>:8081 in a web browser.

Conclusion

We've done it! We found Portainer, and set it up to help with managing Docker servers. Congratulations!