This project showcases the successful deployment of Portainer, a powerful management UI for Docker, on an Amazon EC2 instance. The aim is to streamline container orchestration and management, providing a user-friendly interface for managing Docker containers and images.
- Launched an EC2 instance with optimal configurations for container deployment.
- Utilized Docker Compose to deploy Portainer, enabling a user-friendly interface for managing Docker containers and images.
- Implemented AWS security group rules to ensure secure access to the Portainer interface while adhering to best practices for network security.
- Configured role-based access control in Portainer, allowing for secure multi-user access and management of containerized applications.
- Monitored performance metrics and optimized the deployment for improved reliability and efficiency.
- An AWS account
- Basic knowledge of Docker and AWS EC2
-
Launch EC2 Instance
- Go to the AWS Management Console and launch a new EC2 instance.
- Choose an Amazon Machine Image (AMI) suitable for your needs.
- Configure instance type, security group, and key pair.
-
Connect to Your EC2 Instance
- Connect to your EC2 instance via SSH:
ssh -i "your-key.pem" ec2-user@<your-ec2-instance-public-ip>
- Connect to your EC2 instance via SSH:
-
Install Docker
- Update the package database:
sudo yum update -y
- Install Docker:
sudo amazon-linux-extras install docker
- Start the Docker service:
sudo service docker start
- Add the
ec2-user
to thedocker
group to run Docker commands withoutsudo
:sudo usermod -aG docker ec2-user
- Log out and log back in to refresh your group membership:
exit
- Update the package database:
-
Install Docker Compose
- Run the following command to install Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose
- Run the following command to install Docker Compose:
-
Deploy Portainer
- Create a
docker-compose.yml
file with the following content:version: '3.3' services: portainer: image: portainer/portainer-ce ports: - "9000:9000" volumes: - /var/run/docker.sock:/var/run/docker.sock - portainer_data:/data volumes: portainer_data:
- Run the following command to deploy Portainer:
docker-compose up -d
- Create a
-
Access Portainer
- Open your web browser and navigate to
http://<your-ec2-instance-public-ip>:9000
. - Follow the setup instructions to create an admin account.
- Open your web browser and navigate to
Feel free to submit issues or pull requests for any improvements or suggestions.
This project is licensed under the MIT License - see the LICENSE file for details.
For any inquiries, please reach out to me at mohammedrashwan.com.