[Working phase 01.03]
-
Install the most recent Docker Community Edition package.
sudo amazon-linux-extras install docker
-
Start the Docker service.
sudo service docker start
-
Add the
ec2-userto thedockergroup so you can execute Docker commands without usingsudo.sudo usermod -a -G docker ec2-user
-
Log out and log back in again to pick up the new
dockergroup permissions. You can accomplish this by closing your current SSH terminal window and reconnecting to your instance in a new one. Your new SSH session will have the appropriatedockergroup permissions. -
Verify that the
ec2-usercan run Docker commands withoutsudo.docker info
Note
In some cases, you may need to reboot your instance to provide permissions for the ec2-user to access the Docker daemon. Try rebooting your instance if you see the following error:
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
- Create a new folder and download all required files
cd ~
mkdir Dockerize
cd Dockerize
wget https://materialien.s3.eu-central-1.amazonaws.com/workshop/dockerize/commands.cli
wget https://materialien.s3.eu-central-1.amazonaws.com/workshop/dockerize/customize.sh
wget https://materialien.s3.eu-central-1.amazonaws.com/workshop/dockerize/postgresql-9.4-1202.jdbc41.jar
wget https://materialien.s3.eu-central-1.amazonaws.com/workshop/dockerize/ticket-monster.war
wget https://materialien.s3.eu-central-1.amazonaws.com/workshop/dockerize/DockerfileWait here and let us talk about the files.
Now we have to create a RDS Instance together
docker build -t ticketmonster .docker run -d -p 8080:8080 -e DB_HOST=ticketmonster-2.cqqhnwljvdgd.eu-central-1.rds.amazonaws.com -e DB_PORT=5432 -e DB_USERNAME=ticketmonster -e DB_PASSWORD=ticketmonster -e DB_NAME=postgres ticketmonster