{"id":2506,"date":"2020-01-25T21:37:47","date_gmt":"2020-01-25T20:37:47","guid":{"rendered":"https:\/\/www.linuxboxen.dk\/?p=2506"},"modified":"2020-01-25T21:37:47","modified_gmt":"2020-01-25T20:37:47","slug":"installere-og-koere-docker-images-fra-dockerhost","status":"publish","type":"post","link":"https:\/\/www.linuxboxen.dk\/?p=2506","title":{"rendered":"Installere og k\u00f8re docker images fra docker.com"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"200\" src=\"https:\/\/www.linuxboxen.dk\/wp-content\/uploads\/2020\/01\/logo-docker-300x200.png\" alt=\"\" srcset=\"https:\/\/www.linuxboxen.dk\/wp-content\/uploads\/2020\/01\/logo-docker-300x200.png 300w, https:\/\/www.linuxboxen.dk\/wp-content\/uploads\/2020\/01\/logo-docker-768x512.png 768w, https:\/\/www.linuxboxen.dk\/wp-content\/uploads\/2020\/01\/logo-docker-360x240.png 360w, https:\/\/www.linuxboxen.dk\/wp-content\/uploads\/2020\/01\/logo-docker.png 900w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/>\t\t\t\t\t\t\t\t\t\t\t<\/p>\n<p>For at installere images\/docker containers fra <a href=\"https:\/\/hub.docker.com\">hub.docker.com<\/a>. kan du bruge search funktionen i docker. Her s\u00f8ger jeg efter webserver nginx containers. der er mange muligheder her.<\/p>\n<p>Du kan l\u00e6se om hvor du installere nginx <a href=\"https:\/\/www.linuxboxen.dk\/installere-docker-paa-ubuntu\/\">her<\/a><\/p>\n<p>Du kan se hele listen p\u00e5 <a href=\"https:\/\/hub.docker.com\/search?q=&amp;type=image\">docker hub.<\/a><\/p>\n<p>For at eksempelvis installere nginx webserver fra docker hub skal du skrive.<\/p>\n<pre>$ sudo docker run -itd --name nginxwebserver nginx \/bin\/bash\n$<\/pre>\n<p>Ingen output dejligt. S\u00e5 k\u00f8re containeren m\u00e5 vi h\u00e5be ?. Der er heldigvis mulig for at checke dette. med ps kommandoen.<\/p>\n<pre>$ sudo docker ps\nCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES\nbab1387d71d7 nginx \"\/bin\/bash\" 6 minutes ago Up 6 minutes 80\/tcp nginxwebserver<\/pre>\n<p>Den er noget som k\u00f8re. hvordan ser jeg s\u00e5 ip adressen s\u00e5 jeg kan tilg\u00e5r webserveren nginx.<\/p>\n<pre>$ sudo docker attach bab1387d71d7<\/pre>\n<p>For at f\u00e5 ip adressen p\u00e5 vores nginx container kan vi installere ifconfig.<\/p>\n<pre>root@bab1387d71d7:\/# apt update\nroot@bab1387d71d7:\/# apt install net-tools\nroot@bab1387d71d7:\/# ifconfig\neth0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt; mtu 1500\ninet 172.17.0.2 netmask 255.255.0.0 broadcast 172.17.255.255\nether 02:42:ac:11:00:02 txqueuelen 0 (Ethernet)\nRX packets 5954 bytes 8975041 (8.5 MiB)\nRX errors 0 dropped 0 overruns 0 frame 0\nTX packets 3004 bytes 201306 (196.5 KiB)\nTX errors 0 dropped 0 overruns 0 carrier 0 collisions 0<\/pre>\n<p>S\u00e5 vi kan nu \u00e5bne en browser og se p\u00e5 ip adressen 172.17.0.2<\/p>\n<p>Yes det virker&#8230;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.linuxboxen.dk\/wp-content\/uploads\/2020\/01\/browser_nginx.png\" alt=\"\" width=\"479\" height=\"370\" \/><\/p>\n<p>Hvor ligger filerne s\u00e5 p\u00e5 webservren. Lad os se p\u00e5 det.<\/p>\n<p>root@bab1387d71d7:\/# cat \/etc\/nginx\/conf.d\/default.conf | grep -e root<br \/>root \/usr\/share\/nginx\/html;<br \/>root \/usr\/share\/nginx\/html;<br \/># root html;<br \/># deny access to .htaccess files, if Apache&#8217;s document root<\/p>\n<p>Vi kan se at root peger p\u00e5 \/usr\/share\/nginx\/html. S\u00e5 for at se filerne der skal vi p\u00e5 webserveren bruge cd kommandoen til det.<\/p>\n<pre>root@bab1387d71d7:\/# cd \/usr\/share\/nginx\/html\nroot@bab1387d71d7:\/usr\/share\/nginx\/html# ls -l\ntotal 8\n-rw-r--r-- 1 root root 494 Jan 21 13:36 50x.html\n-rw-r--r-- 1 root root 612 Jan 21 13:36 index.html\n<\/pre>\n<p>Her kan du se listen af ubuntu images her.<\/p>\n<pre>$ sudo docker search ubuntu\nNAME DESCRIPTION STARS OFFICIAL AUTOMATED\nubuntu Ubuntu is a Debian-based Linux operating sys\u2026 10416 [OK] \ndorowu\/ubuntu-desktop-lxde-vnc Docker image to provide HTML5 VNC interface \u2026 385 [OK]\nrastasheep\/ubuntu-sshd Dockerized SSH service, built on top of offi\u2026 240 [OK]\nconsol\/ubuntu-xfce-vnc Ubuntu container with \"headless\" VNC session\u2026 208 [OK]\nubuntu-upstart Upstart is an event-based replacement for th\u2026 103 [OK] \nansible\/ubuntu14.04-ansible Ubuntu 14.04 LTS with ansible 98 [OK]\nneurodebian NeuroDebian provides neuroscience research s\u2026 63 [OK] \n1and1internet\/ubuntu-16-nginx-php-phpmyadmin-mysql-5 ubuntu-16-nginx-php-phpmyadmin-mysql-5 50 [OK]\nubuntu-debootstrap debootstrap --variant=minbase --components=m\u2026 42 [OK] \nnuagebec\/ubuntu Simple always updated Ubuntu docker images w\u2026 24 [OK]\ni386\/ubuntu Ubuntu is a Debian-based Linux operating sys\u2026 18 \n1and1internet\/ubuntu-16-apache-php-5.6 ubuntu-16-apache-php-5.6 14 [OK]\n1and1internet\/ubuntu-16-apache-php-7.0 ubuntu-16-apache-php-7.0 13 [OK]\n1and1internet\/ubuntu-16-nginx-php-phpmyadmin-mariadb-10 ubuntu-16-nginx-php-phpmyadmin-mariadb-10 11 [OK]\n1and1internet\/ubuntu-16-nginx-php-5.6 ubuntu-16-nginx-php-5.6 8 [OK]\n1and1internet\/ubuntu-16-nginx-php-5.6-wordpress-4 ubuntu-16-nginx-php-5.6-wordpress-4 7 [OK]\n1and1internet\/ubuntu-16-apache-php-7.1 ubuntu-16-apache-php-7.1 6 [OK]\ndarksheer\/ubuntu Base Ubuntu Image -- Updated hourly 5 [OK]\n1and1internet\/ubuntu-16-nginx-php-7.0 ubuntu-16-nginx-php-7.0 4 [OK]\npivotaldata\/ubuntu A quick freshening-up of the base Ubuntu doc\u2026 3 \npivotaldata\/ubuntu16.04-build Ubuntu 16.04 image for GPDB compilation 2 \n1and1internet\/ubuntu-16-sshd ubuntu-16-sshd 1 [OK]\n1and1internet\/ubuntu-16-php-7.1 ubuntu-16-php-7.1 1 [OK]\nsmartentry\/ubuntu ubuntu with smartentry 1 [OK]\npivotaldata\/ubuntu-gpdb-dev Ubuntu images for GPDB development 1 \n<\/pre>\n<p><a href=\"https:\/\/www.linuxboxen.dk\/export-docker-container-og-gem-images\/\">Export og gem docker container<\/a><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_2506\" class=\"pvc_stats all  \" data-element-id=\"2506\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/www.linuxboxen.dk\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>For at installere images\/docker containers fra hub.docker.com. kan du bruge search funktionen i docker. Her s\u00f8ger jeg efter webserver nginx containers. der er mange muligheder her. Du kan l\u00e6se om hvor du installere nginx her Du kan se hele listen p\u00e5 docker hub. For at eksempelvis installere nginx webserver fra docker hub skal du skrive. [&hellip;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_2506\" class=\"pvc_stats all  \" data-element-id=\"2506\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/www.linuxboxen.dk\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"categories":[2,18],"tags":[],"class_list":["post-2506","post","type-post","status-publish","format-standard","hentry","category-tips","category-docker"],"a3_pvc":{"activated":true,"total_views":35,"today_views":0},"_links":{"self":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts\/2506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2506"}],"version-history":[{"count":0,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts\/2506\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2506"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2506"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}