Professional Documents
Culture Documents
Docker Installation AWS
Docker Installation AWS
Step 8: Click the Launch Instance and Add the Key pair
Step 12: Once Docker is installed You are able to see these options
docker
Step 13: Start the Docker service, Using
Step 14: Add the ec2-user to the docker group so you can execute Docker commands without using
sudo.
Verify that the ec2-user can run Docker commands without sudo.
docker info
Step 15: Restart the Ec2 Instance, then you are able to see all Details about the Docker
Step 16: Create a Docker Image, using
touch Dockerfile
Step 17: Edit the Docker file you just created and add the following content.
This Docker file uses the Ubuntu 18.04 image. The RUN instructions update the package caches,
install some software packages for the web server, and then write the "Hello World!" content to the
web server's document root. The EXPOSE instruction exposes port 80 on the container, and the CMD
instruction starts the web server.
FROM ubuntu:18.04
# Install dependencies
# Configure apache
EXPOSE 80
CMD /root/run_apache.sh
Note: Copy the code and paste into the Docker File using, Nano
nano Dockerfile
Step 18: Build the Docker image from your Dockerfile.
Step 19: Run docker images to verify that the image was created correctly.
Step 20: Run the newly built image. The -p 80:80 option maps the exposed port 80 on the container
to port 80 on the host system. For more information about docker run
Step 21: Go to the Ec2 Instance, Copy the Public Ip of the Ec2 Instance and Put into the Browser