Wednesday, December 13, 2017

How to use Portainer in Docker?

Portainer is a lightweight management UI which allows you to easily manage your Docker host or Swarm cluster.

Setup Portainer in Docker

  1. Double click on Docker app-icon to start Docker engine
  2. Open Terminal on MacOS or Command-line on Windows after Docker is running
  3. Type docker and press enter 
  4. If docker comands gets listed then it is runnning properly, otherwise read logs to debug further
  5. Now type this command to create a container named portainer and run it
    • docker run --name portainer -d -p 9000:9000 --restart always -v /var/run/docker.sock:/var/run/docker.sock -v /Users/abhishekkumar/Documents/Programs/portainer:/data portainer/portainer
    • Here, /Users/abhishekkumar/Documents/Programs can be replaced with your custom path
  6. Open web-browser and go to localhost:9000
  7. A Portainer GUI would open, if everything works fine
  8. Fill up the form by setting admin password
  9. Click on Local Connection tab to connect with locally running portainer webapp
  10. Further explore the app

Stop the running Portainer or start/restart again

  1. Open Terminal and run this command to stop the container
    • docker stop portainer
  2. Run this command to restart the container again
    • docker restart portainer
  3. Or run this command to start the container in future
    • docker start portainer

No comments:

Post a Comment