Portainer in Docker
What is Docker?
Docker is an incredibly useful program that allows you to run applications in containers. A container is a small package that includes the application, all the files it needs, and any required settings or dependencies. With Docker, you don’t have to install or configure anything manually. You can download a container, and the application will work the same as if you did it manually, but with way less of a headache. Docker is useful since it keeps everything organized, prevent conflicts between your programs, and it makes it easy to run and manage software. It almost completely negates incompatibility issues.
What is Portainer?
Portainer is a tool that makes it easier to manage Docker containers. By default, Docker is controlled using the command line, a complete text based interface, which can be very confusing for beginners. Portainer solves this by giving a super simple web-based interface that you can open in whatever browser you use.
With Portainer you can view all of your containers in one place, start, stop, or restart your containers, or create and manage containers without typing out the commands. This is especially useful because it complifies container management, reduces the need to remember or write down multiple commands, and makes Docker way more accessible for beginners!
Why use Portainer?
Using Docker on its own isn’t difficult for advanced users, but beginners definitely have some issues using the command line. This is why Portainer is useful! It works with Docker to provide a simple, visual way to manager your containers. Using Portainer with Docker allows you to:
- Manage containers more easily
- Understand what is happening in your environment
- Reduce mistakes caused by typing incorrect commands
Together, Docker and Portainer make it much easier to run and manage applications, especially for users who are new to using Docker and containers! Using Portainer makes it easier to run and manage everything.
Running Portainer in Docker
Now that the basics are out of the way, lets go onto installing Docker and how to use Portainer in it. This is a tutorial specifically for Windows 10/11.
- Download Docker
The first step is to download Docker, you can skip this portion if you already have Docker downloaded. But if you don’t, continue on.
To download Docker, go to this website; https://www.docker.com/, and click on “Get Started” in the corner!
This will take you to the “Get Started with Docker” page, where you can hover over the “Download” button, and select Windows.
2. Install Docker
Now, since you’ve downloaded the launcher for Docker, it's time to install it! Locate it on your computer, most likely in the “downloads” folder, right click on it and click “Open”.
Opening it will prompt a pop-up asking if you want to allow Docker to make changes to your device, press “Yes” to allow it.
This will bring up a screen asking if you want a desktop icon for the application. This choice is entirely up to you, then click “Ok.”
After that, Docker will begin installing on your machine. If its working, it should look like this:
Once its done, you’ll need to restart Windows to continue, Docker will give you the option to “Close and restart”, this WILL restart your computer!!!
Congratulations, Docker is now downloaded!
3. Using Docker Desktop
Once your computer is reset, find your Docker app from the desktop (if you ticked the box previously), right click it and run it as administrator. This will prompt another pop-up, click “Yes” to allow it to run as administrator.
After opening Docker, you will be asked to agree to the Docker Subscription Service Agreement. Click “Accept” here, you can also view the full terms of agreement, by clicking the “View Full Terms” button.
After you agree, you’ll be brought to the “Welcome to Docker Desktop” screen. You can choose to sign in with your own account, but for this, its optional!
After that, you should be brought to a page that looks like this:
This means your Docker is completely operational! If so, you can continue onto step 4.
Get C. Offutt’s stories in your inbox
Join Medium for free to get updates from this writer.
Note: Its possible that you’re able to download Docker, but you get an error in the application regarding WSL (Windows Subsystem for Linux). Docker essentially creates a virtual machine with Linux to run Docker and its needs. This can happen if you didn’t run the app as administrator the first time you opened it. To fix this, you can open command prompt and type “wsl — install” without the quotation marks, and it should install WSL and Docker will run properly. There should be a section in Docker to copy this command, and a button to update it that will open command prompt.
4. Downloading and Using Portainer
Now that Docker is completely downloaded and Docker Engine is running, containers can now be created. To search for your preferred containers, click at the search bar at the top.
Once you click on it, it'll take you to its searching function. In the top bar, type “Portainer”.
It should be the first container, called “portainer/portainer”, once you find it, click “Pull”. This will pull the container image onto your machine to run with your other containers! It’ll take a second to pull, but once it does, you’ll get a notification in the bottom right.
Note: Because Portainer is a container that gives other containers a physical GUI, its recommended to pull another container of your choice. I’m not going to be doing that in this guide.
From here, you can click on the “Images” tab on the left to see all the containers you’ve downloaded.
To run Portainer, you’ll have to use the command prompt. Open your command prompt and type in the following:
docker ps
docker run -d -p 9443:9443 — name portainer — restart=always portainer/portainer-ce:lts
OR:
While creating the container, you’re able to edit it. Make sure the top and bottom host ports are set to 8000 and 9443. Like this;
It should give the same result with the next step.
Since Portainer is already on the Docker Desktop (make sure to keep Docker Desktop open throughout the process), the command will put you in Docker Powershell, and then open the connection on port 9443:9443.
If you don’t get an error message, its worked! Then, go into any browser of your choice and type in the url:
Note: 127.0.0.1 is the loopback address, you could also use the url https://localhost:9443 and it should work the same.
You might get a warning from the browser that the connection is unsafe, you can continue on to Portainer safely. It should bring you to a login interface like this:
Make your own password, and username, and select create user. It’ll take you to the screen shown below.
Then boom, you’ve located the Portainer GUI.
From here, you can add new environments like;
Docker Standalone, which is a connection to a single container.
Docker Swarm, which is a connection to multiple containers.
Kubernetes, which allows you to connect to a kubernetes environment.
ACI, which allows you to connect to an ACI environment.
Nomad, which will allow you to connect to a hashicorp nomad environment.
Finally, KaaS, which is like a Kubernetes connection but with a cloud provider that sets everything up for you.
5. Bask in your victory
Now that you’ve downloaded and explored Portainers connection options, you’re free to go in and pull new containers to manage in Portainer. But, you’ve jumped a hurdle that took me two weeks to figure out and write down this guide! So, that deserves a much needed break to bask in your victory.
Thank you for reading this guide, I hope it was a nice baseline to help you get started.




