I. Introduction
Why use portainer to manage docker apps?
- There are quite a few of you when using docker having problems with the statement that has it, every time you check the list of containers or images, even deleting it, a lot of commands are correct.
- Another problem is that when your system needs to use too many services and containers, command line management becomes difficult and difficult to see. That’s why portainer solves the problem of managing docker apps and manipulating them more conveniently in the UI interface.
II. Setting
Deploy Portainer on Linux:
1 2 3 | $ docker volume create portainer_data $ docker run -d -p 8000:8000 -p 9000:9000 --name <span class="token operator">=</span> portainer --restart <span class="token operator">=</span> always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer |
Deploy Portainer on Windows:
1 2 3 | $ docker volume create portainer_data $ docker run -d -p 8000:8000 -p 9000:9000 --name portainer --restart always -v \.pipedocker_engine:\.pipedocker_engine -v portainer_data:C:data portainer/portainer |
Init Docker Swarm on Linux:
Portainer manages docker apps with swarm docker, so you need to init dock swarm with your device’s ip (or server) to deploy the stack.
1 2 3 4 5 6 7 8 9 10 11 | $ docker swarm init --advertise-addr 192.168.1.34 Swarm initialized: current node <span class="token punctuation">(</span> bvz81updecsj6wjz393c09vti <span class="token punctuation">)</span> is now a manager. To add a worker to this swarm, run the following command: docker swarm <span class="token function">join</span> --token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx 172.17.0.2:2377 To add a manager to this swarm, run <span class="token string">'docker swarm join-token manager'</span> and follow the instructions. |
Deploy docker stack on Linux:
1 2 3 | $ <span class="token function">curl</span> -L https://downloads.portainer.io/portainer-agent-stack.yml -o portainer-agent-stack.yml $ docker stack deploy --compose-file <span class="token operator">=</span> portainer-agent-stack.yml portainer |
Deploy docker stack on Windows:
1 2 3 | $ <span class="token function">curl</span> https://downloads.portainer.io/portainer_windows_stack.yml -o portainer_windows_stack.yml $ docker stack deploy --compose-file <span class="token operator">=</span> portainer_windows_stack.yml portainer |
III. Use
After installing docker container for portainer, they go into the browser and type the url: http://192.168.1.34:9000
Above is my computer’s ip, go to network settings to get the ip and init with the swarm docker as above. If successful, it will display the login screen as below. You enter your password and then click create user.
After logging in successfully, we will go to the dashboard of portainer as below.
In the dashboard page portainer gave us a default endpoint is primary
you can to rename or create new arbitrary endpoint.
After the update is complete, you click to update endpoint. In the endpoint include management for stacks, services, containers, images, networks, etc. You can add the stack directly in the management page. By adding the docker-compose file
Or you can also run by command then view and manage on the dashboard. That is also the reason for creating portainer dashboard
And here are the stacks after we have run docker-compose.yml with command or deploy on the dashboard
As you can see after running docker-compose, my current stacks include containers as below
Now you can start, stop, or even remove containers without having to type the command line.
Services management screen:
Container management screen: We can handle all container tasks
Instead of before we have to see on the command line:
Images management screen: We can manipulate all tasks of images
Instead of before we have to see on the command line:
…. Now you can completely control the whole docker system for your project here.
IV. Conclusion
For small projects that do not use too many services or containers docker, you do not need to install portainer to manage, you still can use the command line to manage for professional. Hopefully through the article you already know about a tool to manage docker apps. Looking forward to your suggestions and discussions a lot.