Docker Set-up Guide

🚧

Note: because this configuration provides no monitoring, automatic restarts, failover, etc, this configuration is intended ONLY for development, test, and CI environments. Do not use this configuration for production - otherwise outages and data loss may occur.

This guide provides step-by-step instructions on deploying the UserClouds Docker container on an Amazon EC2 instance. This setup is useful for environments where you need to manage the Docker container lifecycle manually.

Prerequisites

  • AWS Account
  • AWS CLI configured
  • Docker installed locally

Steps

  1. Launch an EC2 Instance
    1. Log in to the AWS Management Console.
    2. Launch an Instance:
      1. Navigate to EC2 Dashboard and click "Launch Instance".
      2. Choose an Amazon Machine Image (AMI). For this guide, we will use the Amazon Linux 2 AMI.
      3. Select an instance type. A t2.micro instance is sufficient for testing, but choose according to your needs.
      4. Configure other instance details as required.
      5. Configure security groups:
        1. Allow SSH (port 22) from your IP address.
        2. Allow HTTP (port 80) and HTTPS (port 443)
    3. Review and Launch:
      1. Review your instance settings and click "Launch".
      2. Select an existing key pair or create a new one to access your instance.
      3. Click "Launch Instances".
    4. Connect to Your Instance:
      1. Once the instance is running, click "Connect" and follow the instructions to SSH into your instance.
  2. Install Docker on the EC2 Instance
    1. Update the Installed Packages: sudo yum update -y
    2. Install Docker: sudo amazon-linux-extras install docker -y
    3. Start the Docker Service: sudo service docker start
    4. Add the ec2-user to the Docker Group: sudo usermod -a -G docker ec2-user
    5. Log Out and Log Back In (to ensure your user permissions are updated)
  3. Pull the UserClouds Docker Image
    1. Reach out to your UserClouds point of contact to obtain the Docker image and any necessary credentials for accessing the Docker registry where the image is hosted.
  4. Run the UserClouds Docker Container
    1. Run the Docker Container: docker run -d --name userclouds-container -p 80:80 name-goes-here
      1. Replace name-goes-here with the name of the UserClouds Docker image.
      2. Adjust the port mapping (-p 80:80) as needed.
  5. Verify the Deployment
    1. Check Running Containers: docker ps
    2. Access Your Application: Open a web browser and navigate to the public IP address of your EC2 instance. You should see the UserClouds application running.
  6. Manual Lifecycle Management
    1. Since the Docker container will not automatically restart if the EC2 instance is terminated, you need to manage the lifecycle manually. Here are some commands to help:
      1. Stop the Docker Container: docker stop userclouds-container
      2. Restart the Docker Container: docker start userclouds-container
      3. Remove the Docker Container: docker rm userclouds-container
      4. Remove the Docker Image: docker rmi name-goes-here

By following these steps, you can successfully deploy and manage the UserClouds Docker container on an EC2 instance. This setup provides flexibility and control over the container lifecycle, although it requires manual intervention for tasks such as restarting the container if the instance is terminated.