{"id":20,"date":"2016-05-12T21:15:44","date_gmt":"2016-05-12T19:15:44","guid":{"rendered":"http:\/\/www.petersplanet.nl\/?p=20"},"modified":"2016-06-15T21:29:37","modified_gmt":"2016-06-15T19:29:37","slug":"run-your-website-with-docker","status":"publish","type":"post","link":"https:\/\/www.petersplanet.nl\/index.php\/2016\/05\/12\/run-your-website-with-docker\/","title":{"rendered":"Run your website using Docker"},"content":{"rendered":"<p>It is relatively easy to run your website with Docker. In this case we are using the nginx webserver with Docker on Amazon AWS.<!--more--><br \/>\nSo first configure the Amazon Linux server for Docker.<br \/>\nUpdate the server<\/p>\n<pre>sudo yum update\r\n<\/pre>\n<p>Then install the Docker Engine.<\/p>\n<pre>sudo yum info docker\r\nsudo yum install docker\r\n<\/pre>\n<p>Start the docker service. Amazon Linux is not using systemd yet because this would break their rolling upgrades policy.<\/p>\n<pre>sudo service docker start\r\nsudo chkconfig --list docker\r\n<\/pre>\n<p>Add your user-account to the docker group. Otherwise you would need to sudo all the time.<\/p>\n<pre>sudo usermod -a -G docker ec2-user\r\n<\/pre>\n<p>Logout and login to make the new settings effective.<\/p>\n<pre>docker info\r\ndocker version\r\ndocker --help\r\n<\/pre>\n<p>Test docker<\/p>\n<pre>docker run hello-world\r\n<\/pre>\n<p>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.<\/p>\n<pre>docker run --name petersplanet01 -v \/var\/www\/html:\/usr\/share\/nginx\/html:ro -p 80:80 -d nginx\r\ndocker ps -a\r\n<\/pre>\n<p>Now the webserver\/website is running in a Docker container.<br \/>\nMore details can be found here:<br \/>\n<a href=\"http:\/\/docs.aws.amazon.com\/AmazonECS\/latest\/developerguide\/docker-basics.html\">aws-docker-basics<\/a><br \/>\n<a href=\"http:\/\/blog.docker.com\/2015\/04\/tips-for-deploying-nginx-official-image-with-docker\/\">blog.docker.com\/2015\/04\/tips-for-deploying-nginx-official-image-with-docker<br \/>\n<\/a><a href=\"http:\/\/www.docker.com\">www.docker.com<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is relatively easy to run your website with Docker. In this case we are using the nginx webserver with Docker on Amazon AWS.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[8,7],"class_list":["post-20","post","type-post","status-publish","format-standard","hentry","category-linux","tag-docker","tag-linux"],"_links":{"self":[{"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/posts\/20","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/comments?post=20"}],"version-history":[{"count":11,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/posts\/20\/revisions"}],"predecessor-version":[{"id":37,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/posts\/20\/revisions\/37"}],"wp:attachment":[{"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/media?parent=20"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/categories?post=20"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/tags?post=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}