Installing Portainer Community Edition with Docker

image_print

Introduction:
Portainer is a powerful open-source container management tool that simplifies Docker deployment and administration. In this guide, we’ll walk you through the installation process for Portainer Community Edition using Docker.

Step 1: Stop Existing Portainer Container (Optional)

If you have an existing Portainer container that you want to replace, you can stop it using the following command:

docker stop portainer

Step 2: Create Docker Volume for Portainer Data

Create a Docker volume to store Portainer’s data persistently:

docker volume create portainer_data

Step 3: Install Portainer Community Edition

Run the Portainer Community Edition container with the following command:

docker run -d -p 9000:9000 \
  --name=portainer \
  --restart=always \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v portainer_data:/data \
  portainer/portainer-ce

Explanation of options used:

  • -d: Run the container in the background (detached mode).
  • -p 9000:9000: Map port 9000 from the container to port 9000 on the host system. This allows you to access Portainer’s web interface at http://localhost:9000.
  • --name=portainer: Assign the name “portainer” to the container for easy management.
  • --restart=always: Configure the container to automatically restart if it stops unexpectedly.
  • -v /var/run/docker.sock:/var/run/docker.sock: Mount the Docker socket on the host to the container. This allows Portainer to interact with the Docker engine on the host.
  • -v portainer_data:/data: Mount the Docker volume “portainer_data” to the “/data” directory inside the container. This volume stores Portainer’s data, ensuring persistence across container restarts.
  • portainer/portainer-ce: Specifies the Docker image to use for running Portainer Community Edition.

Step 4: Access Portainer Web Interface

Once the Portainer container is up and running, open a web browser and navigate to http://localhost:9000. You will be directed to Portainer’s web interface. Follow the setup wizard to create an admin user and configure Portainer.

Congratulations! You have successfully installed Portainer Community Edition using Docker. You can now start managing your Docker containers and services through the intuitive Portainer interface.

Enjoy the simplicity and power of Docker management with Portainer Community Edition! Happy containerizing!

You may also like...