Run your website using Docker

It is relatively easy to run your website with Docker. In this case we are using the nginx webserver with Docker on Amazon AWS.
So first configure the Amazon Linux server for Docker.
Update the server

sudo yum update

Then install the Docker Engine.

sudo yum info docker
sudo yum install docker

Start the docker service. Amazon Linux is not using systemd yet because this would break their rolling upgrades policy.

sudo service docker start
sudo chkconfig --list docker

Add your user-account to the docker group. Otherwise you would need to sudo all the time.

sudo usermod -a -G docker ec2-user

Logout and login to make the new settings effective.

docker info
docker version
docker --help

Test docker

docker run hello-world

A static website can been copied to /var/www/html/ The pages are mapped readonly to /usr/share/nginx/html on the nginx webserver. Port 80 on the server is mapped to port 80 on de docker container.

docker run --name petersplanet01 -v /var/www/html:/usr/share/nginx/html:ro -p 80:80 -d nginx
docker ps -a

Now the webserver/website is running in a Docker container.
More details can be found here: