Build and run Portainer Container Management tool in a Docker
August 7, 2023 2023-08-18 9:09Build and run Portainer Container Management tool in a Docker
Portainer is a popular open-source container management tool used to simplify the deployment and management of Docker containers. It is used to decrease the operational difficulties and security challenges of running containers in Docker.
Here are the steps to build and run Portainer Community Edition(CE):
Install Docker:
Portainer needs Docker to be installed on your system. You can follow the official Docker installation instructions for your operating system: https://docs.docker.com/get-docker/
Create a Docker Volume:
Portainer CE needs continuous storage for its data. You can create a Docker volume to store this data by using the below comamnd.
docker volume create portainer_data
List out the docker volume:
If you want to check the docker volume is created successfully. Use the belowcommand to list out the configured volume in your docker.
docker volume ls
DRIVER VOLUME NAME
local portainer_data
Install and Run Portainer CE Container:
Install and Run the Portainer CE container using the following command:
docker run -d -p 9000:9000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
Explanation:
-d: Run the container in detached mode.
-p 9000:9000: Map port 9000 of the host to port 9000 of the container.
–name=portainer: Assign a name to the container.
–restart=always: Set the container to automatically restart on system boot or container failure.
-v /var/run/docker.sock:/var/run/docker.sock: Mount the Docker socket to allow Portainer to manage Docker on the host.
-v portainer_data:/data: Mount the data volume to store Portainer CE’s persistent dat
Once the portainer docker image is downloaded and installed in your machine just make sure that the Portainer is running using the command below,
docker container ls