{"id":6909,"date":"2019-01-11T22:22:26","date_gmt":"2019-01-11T21:22:26","guid":{"rendered":"https:\/\/pi3g.com\/?p=6909"},"modified":"2019-01-11T22:22:26","modified_gmt":"2019-01-11T21:22:26","slug":"install-crystal-on-docker-how-to-add-the-crystal-repository-to-docker-in-the-dockerfile","status":"publish","type":"post","link":"https:\/\/pi3g.com\/de\/install-crystal-on-docker-how-to-add-the-crystal-repository-to-docker-in-the-dockerfile\/","title":{"rendered":"Crystal auf Docker installieren: So f\u00fcgen Sie das Crystal-Repository in der Dockerdatei zu Docker hinzu"},"content":{"rendered":"<h2>Dockerfile (excerpt)<\/h2>\n<blockquote>\n<p>ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn<br \/>\nRUN apt-get update &amp;&amp; apt-get install -y \\ <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; software-properties-common \\ <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; build-essential \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libevent-dev \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libssl-dev \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libxml2-dev \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libyaml-dev \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libgmp-dev \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libreadline-dev \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; apt-transport-https \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iputils-ping \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; git \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; aptitude \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nano \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; openssh-server \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;&amp; apt-key adv &#8211;keyserver keys.gnupg.net &#8211;recv-keys 09617FD37CC06B54 \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;&amp; add-apt-repository &#8216;deb <a href=\"https:\/\/dist.crystal-lang.org\/apt\">https:\/\/dist.crystal-lang.org\/apt<\/a> crystal main&#8217; \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;&amp; apt-get update \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;&amp; apt-get install -y crystal \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;&amp;&nbsp; rm -rf \/var\/lib\/apt\/lists\/* \\<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;&amp; mkdir \/root\/.ssh<\/p>\n<\/blockquote>\n<p>The <strong>ENV APT_KEY_DONT_WARN_ON_DANGEROUSE_USAGE<\/strong> is <strong>needed<\/strong> for apt-key adv not choking on not being run from a terminal.<\/p>\n<h2>To add the Crystal repository, the key needs to be installed<\/h2>\n<blockquote>\n<p>W: GPG error: <a href=\"https:\/\/dist.crystal-lang.org\/apt\">https:\/\/dist.crystal-lang.org\/apt<\/a> crystal InRelease: The following signatures couldn&#8217;t be verified because the public key is not available: NO_PUBKEY 09617FD37CC06B54<br \/>\nE: The repository &#8216;<a href=\"https:\/\/dist.crystal-lang.org\/apt\">https:\/\/dist.crystal-lang.org\/apt<\/a> crystal InRelease&#8217; is not signed.<\/p>\n<\/blockquote>\n<h2>When you add the key using a Dockerfile, you might get the following error message:<\/h2>\n<blockquote>\n<p>Executing: \/tmp\/apt-key-gpghome.daecBAEPSJ\/gpg.1.sh &#8211;keyserver keys.gnupg.net &#8211;recv-keys 09617FD37CC06B54<br \/>\ngpg: keyserver receive failed: Cannot assign requested address<\/p>\n<\/blockquote>\n<p>This is due to gpg not being able to bind to an IPv6 address. Therefore you have to <\/p>\n<h2>enable IPv6 support on your host for Docker:<\/h2>\n<p>edit \/ create <strong>\/etc\/docker\/daemon.json<\/strong><\/p>\n<blockquote>\n<pre><code>{\n  \"ipv6\": true,\n  \"fixed-cidr-v6\": \"2001:db8:1::\/64\"\n}<\/code><\/pre>\n<pre><code><br><\/code><\/pre>\n<\/blockquote>\n<p>And restart the docker service:<\/p>\n<blockquote>\n<p><code>service docker restart<\/code><\/p>\n<\/blockquote>\n<pre><\/pre>\n<p><\/p>\n<p>the fixed-cidr-v6 is <strong>NOT<\/strong> optional as <a href=\"https:\/\/docs.docker.com\/config\/daemon\/ipv6\/\">https:\/\/docs.docker.com\/config\/daemon\/ipv6\/<\/a> might lead you to believe.<\/p>\n<p>test for IPv6 support:<\/p>\n<blockquote>\n<pre><code>docker run -it alpine ash -c \"ip -6 addr show dev eth0; ip -6 route show\"<\/code><\/pre>\n<\/blockquote>\n<pre><code><font face=\"Calibri\">if it returns nothing, then ipv6 is NOT enabled<\/font><\/code><\/pre>\n<pre><code><font face=\"Calibri\"><code><font face=\"Calibri\">sample output with IPv6 enabled:<\/font><\/code><\/font><\/code><\/pre>\n<blockquote>\n<p>max@morpheus:~\/docker$ docker run -it alpine ash -c &#8220;ip -6 addr show dev eth0; ip -6 route show&#8221;<br \/>\n163: eth0@if164: &lt;BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN&gt; mtu 1500 state UP<br \/>&nbsp;&nbsp;&nbsp;&nbsp; inet6 2001:db8:1::242:ac11:2\/64 scope global flags 02<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; valid_lft forever preferred_lft forever<br \/>&nbsp;&nbsp;&nbsp;&nbsp; inet6 fe80::42:acff:fe11:2\/64 scope link tentative<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; valid_lft forever preferred_lft forever<br \/>\n2001:db8:1::\/64 dev eth0&nbsp; metric 256<br \/>\nfe80::\/64 dev eth0&nbsp; metric 256<br \/>\ndefault via 2001:db8:1::1 dev eth0&nbsp; metric 1024<br \/>\nff00::\/8 dev eth0&nbsp; metric 256\n<\/p>\n<pre><pre><code><br><\/code><\/pre>\n<pre><br><\/pre>\n<\/blockquote>\n<h2>Failed to start Docker Application Container Engine.<\/h2>\n<blockquote>\n<p>tail \u2013n 50 \/var\/log\/syslog<\/p>\n<\/blockquote>\n<p>Jan 11 21:39:35 morpheus dockerd[697]: time=&#8221;2019-01-11T21:39:35.770500563+01:00&#8243; level=warning msg=&#8221;Your kernel does not support swap memory limit&#8221;<br \/>\nJan 11 21:39:35 morpheus dockerd[697]: time=&#8221;2019-01-11T21:39:35.770617796+01:00&#8243; level=warning msg=&#8221;Your kernel does not support cgroup rt period&#8221;<br \/>\nJan 11 21:39:35 morpheus dockerd[697]: time=&#8221;2019-01-11T21:39:35.770656361+01:00&#8243; level=warning msg=&#8221;Your kernel does not support cgroup rt runtime&#8221;<\/p>\n<p>Jan 11 21:39:40 morpheus dockerd[697]: time=&#8221;2019-01-11T21:39:40.800355314+01:00&#8243; level=info msg=&#8221;Default bridge (docker0) is assigned with an IP address 172.17.0.0\/16. Daemon option &#8211;bip can be used to set a preferred IP address&#8221;<\/p>\n<p>Jan 11 21:39:40 morpheus dockerd[697]: Error starting daemon: Error initializing network controller: <strong>Error creating default &#8220;bridge&#8221; network: could not find an available, non-overlapping IPv6 address pool among the defaults to assign to the network<\/strong><\/p>\n<p>If the docker daemon does not start, look at \/var\/log\/syslog to find the reason. <\/p>\n<p>Here it probably means <strong>that you have not added the fixed-cidr-v6 <\/strong>as indicated by me above! Docker, since a couple of versions, seems to require this. There is an issue in GitHub about it.<\/p>\n<p><\/p>\n<p>and all this for \u2026<\/p>\n<p><a href=\"https:\/\/pi3g.com\/wp-content\/uploads\/2019\/01\/image-30.png\"><img loading=\"lazy\" decoding=\"async\" width=\"558\" height=\"66\" title=\"image\" style=\"display: inline; background-image: none;\" alt=\"image\" src=\"https:\/\/pi3g.com\/wp-content\/uploads\/2019\/01\/image_thumb-29.png\" border=\"0\"><\/a><\/p>\n<h3>References<br \/><\/h3>\n<p><a href=\"https:\/\/github.com\/inversepath\/usbarmory-debian-base_image\/issues\/9\">https:\/\/github.com\/inversepath\/usbarmory-debian-base_image\/issues\/9<\/a><\/p>\n<p><a href=\"https:\/\/docs.docker.com\/v17.09\/engine\/userguide\/networking\/default_network\/ipv6\/\">https:\/\/docs.docker.com\/v17.09\/engine\/userguide\/networking\/default_network\/ipv6\/<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/moby\/moby\/issues\/36954\">https:\/\/github.com\/moby\/moby\/issues\/36954<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dockerfile (Auszug) ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn RUN apt-get update &amp;&amp; apt-get install -y \\ software-properties-common \\ build-essential \\ libevent-dev \\ libssl-dev \\ libxml2-dev \\ libyaml-dev \\ libgmp-dev \\ libreadline-dev \\ apt-transport-https \\ iputils-ping \\ git \\ aptitude \\ nano \\ openssh-server \\ &amp;&amp; apt-key adv -keyserver keys.gnupg.net -recv-keys 09617FD37CC06B54 \\ &amp;&amp; add-apt-repository 'deb https:\/\/dist.crystal-lang.org\/apt crystal...<\/p>","protected":false},"author":830,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[416,467],"tags":[473,472,409,468,474,470,471,312,469],"class_list":["post-6909","post","type-post","status-publish","format-standard","hentry","category-crystal-language","category-docker","tag-adding-key","tag-apt-key","tag-crystal","tag-docker","tag-docker-daemon-not-starting","tag-dockerfile","tag-gpg","tag-ipv6","tag-repository"],"_links":{"self":[{"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/posts\/6909","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/users\/830"}],"replies":[{"embeddable":true,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/comments?post=6909"}],"version-history":[{"count":1,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/posts\/6909\/revisions"}],"predecessor-version":[{"id":6910,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/posts\/6909\/revisions\/6910"}],"wp:attachment":[{"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/media?parent=6909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/categories?post=6909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/tags?post=6909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}