<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Docker on Daniel Pomfret</title>
    <link>https://pomfret.uk/tags/docker/</link>
    <description>Recent content in Docker on Daniel Pomfret</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <copyright>© Daniel Pomfret</copyright>
    <lastBuildDate>Sun, 28 Jul 2019 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://pomfret.uk/tags/docker/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>GitLab CI: failed to dial gRPC: cannot connect to the Docker daemon. Is &#39;docker daemon&#39; running on this host?</title>
      <link>https://pomfret.uk/posts/gitlab-ci-failed-to-dial-grpc-cannot-connect-to-the-docker-daemon-is-docker-daemon-running-on-this-host/</link>
      <pubDate>Sun, 28 Jul 2019 00:00:00 +0000</pubDate>
      <guid>https://pomfret.uk/posts/gitlab-ci-failed-to-dial-grpc-cannot-connect-to-the-docker-daemon-is-docker-daemon-running-on-this-host/</guid>
      <description>&lt;p&gt;The latest docker:dind has breaking changes. Here are two fixes if you are enchanting issues with GitLab CI and your runners.&lt;/p&gt;&#xA;&lt;h2 id=&#34;fix-1-gitlab-ci-config&#34;&gt;Fix 1: GitLab CI Config&lt;/h2&gt;&#xA;&lt;p&gt;Add the following to your .gitlab-ci.yml&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-gdscript3&#34; data-lang=&#34;gdscript3&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;variables:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    DOCKER_TLS_CERTDIR: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;fix-2-change-runner-config&#34;&gt;Fix 2: Change runner config&lt;/h2&gt;&#xA;&lt;p&gt;Alternatively, another fix is to change the runner:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ nano /etc/gitlab-runner/config.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Modify to mach the following (specifically environment and volumes)&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[runners]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  environment = [&amp;#34;DOCKER_DRIVER=overlay2&amp;#34;,&amp;#34;DOCKER_TLS_VERIFY=1&amp;#34;,&amp;#34;DOCKER_CERT_PATH=/certs/client&amp;#34;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  [runners.docker]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    image = &amp;#34;docker:dind&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    privileged = true&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    disable_entrypoint_overwrite = false&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    oom_kill_disable = false&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    disable_cache = false&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    volumes = [&amp;#34;/cache&amp;#34;,&amp;#34;/certs&amp;#34;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then restart the gitlab runner&lt;/p&gt;</description>
    </item>
    <item>
      <title>Docker stop all Containers</title>
      <link>https://pomfret.uk/posts/docker-stop-all-containers/</link>
      <pubDate>Tue, 09 Oct 2018 00:00:00 +0000</pubDate>
      <guid>https://pomfret.uk/posts/docker-stop-all-containers/</guid>
      <description>&lt;p&gt;Last brain dump of today. Here&amp;rsquo;s some quick commands to stop running docker containers and also clean up afterwards (remove container files, and images).&lt;/p&gt;&#xA;&lt;p&gt;Stop all containers:&lt;/p&gt;&#xA;&lt;p&gt;docker stop $(docker ps -aq)&lt;/p&gt;&#xA;&lt;p&gt;Remove all containers:&lt;/p&gt;&#xA;&lt;p&gt;docker rm $(docker ps -aq)&lt;/p&gt;&#xA;&lt;p&gt;Remove all images:&lt;/p&gt;&#xA;&lt;p&gt;docker rmi $(docker images -q)&lt;/p&gt;</description>
    </item>
    <item>
      <title>GitLab : Build Docker Image within CI/CD Pipeline</title>
      <link>https://pomfret.uk/posts/gitlab-build-docker-image-within-ci-cd-pipeline/</link>
      <pubDate>Tue, 09 Oct 2018 00:00:00 +0000</pubDate>
      <guid>https://pomfret.uk/posts/gitlab-build-docker-image-within-ci-cd-pipeline/</guid>
      <description>&lt;p&gt;Another brain dump for future reference. This is when setting up gitlab to build and run docker images when the CI/CD pipeline runs.&lt;/p&gt;&#xA;&lt;h2 id=&#34;install-gitlab-runner&#34;&gt;Install gitlab-runner&lt;/h2&gt;&#xA;&lt;p&gt;On a linux x86-64 download the gitlab-runner package:&lt;/p&gt;&#xA;&lt;p&gt;sudo wget -O /usr/local/bin/gitlab-runner &lt;a href=&#34;https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64&#34;&gt;https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Give it permissions:&lt;/p&gt;&#xA;&lt;p&gt;sudo chmod +x /usr/local/bin/gitlab-runner&lt;/p&gt;&#xA;&lt;p&gt;Install docker:&lt;/p&gt;&#xA;&lt;p&gt;curl -sSL &lt;a href=&#34;https://get.docker.com/&#34;&gt;https://get.docker.com/&lt;/a&gt; | sh&lt;/p&gt;&#xA;&lt;p&gt;Create the gitlab-runner user:&lt;/p&gt;&#xA;&lt;p&gt;sudo useradd &amp;ndash;comment &amp;lsquo;GitLab Runner&amp;rsquo; &amp;ndash;create-home gitlab-runner &amp;ndash;shell /bin/bash&lt;/p&gt;&#xA;&lt;p&gt;Install gitlab-runner:&lt;/p&gt;&#xA;&lt;p&gt;sudo gitlab-runner install &amp;ndash;user=gitlab-runner &amp;ndash;working-directory=/home/gitlab-runner&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
