mirror of
https://github.com/davegallant/davegallant.github.io.git
synced 2025-08-14 12:20:19 +00:00
deploy: 1ff0e68a91931d15c85aa3d34dcd8f6cf32550be
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<meta property="og:url" content="/blog/2021/10/11/replacing-docker-with-podman-on-macos-and-linux/">
|
||||
<meta property="og:site_name" content="davegallant">
|
||||
<meta property="og:type" content="article"><meta property="article:section" content="post"><meta property="article:tag" content="docker"><meta property="article:tag" content="podman"><meta property="article:tag" content="containers"><meta property="article:published_time" content="2021-10-11T10:43:35-04:00"><meta property="article:modified_time" content="2021-10-11T10:43:35-04:00"><meta name=twitter:card content="summary">
|
||||
<meta name=generator content="Hugo 0.88.0">
|
||||
<meta name=generator content="Hugo 0.89.4">
|
||||
<title>Replacing docker with podman on macOS (and Linux) • davegallant</title>
|
||||
<link rel=canonical href=/blog/2021/10/11/replacing-docker-with-podman-on-macos-and-linux/>
|
||||
<link rel=icon href=/favicon.ico>
|
||||
@@ -178,21 +178,21 @@ podman machine init
|
||||
podman machine start
|
||||
</code></pre></div><h3 id=running-a-container>Running a container</h3>
|
||||
<p>Let’s try to pull an image:</p>
|
||||
<pre tabindex=0><code class=language-console data-lang=console>$ podman pull alpine
|
||||
Trying to pull docker.io/library/alpine:latest...
|
||||
Getting image source signatures
|
||||
Copying blob sha256:a0d0a0d46f8b52473982a3c466318f479767577551a53ffc9074c9fa7035982e
|
||||
Copying config sha256:14119a10abf4669e8cdbdff324a9f9605d99697215a0d21c360fe8dfa8471bab
|
||||
Writing manifest to image destination
|
||||
Storing signatures
|
||||
14119a10abf4669e8cdbdff324a9f9605d99697215a0d21c360fe8dfa8471bab
|
||||
</code></pre><blockquote>
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-console data-lang=console><span style=color:#009;font-weight:700>$ </span>podman pull alpine
|
||||
<span style=color:#aaa>Trying to pull docker.io/library/alpine:latest...
|
||||
</span><span style=color:#aaa>Getting image source signatures
|
||||
</span><span style=color:#aaa>Copying blob sha256:a0d0a0d46f8b52473982a3c466318f479767577551a53ffc9074c9fa7035982e
|
||||
</span><span style=color:#aaa>Copying config sha256:14119a10abf4669e8cdbdff324a9f9605d99697215a0d21c360fe8dfa8471bab
|
||||
</span><span style=color:#aaa>Writing manifest to image destination
|
||||
</span><span style=color:#aaa>Storing signatures
|
||||
</span><span style=color:#aaa>14119a10abf4669e8cdbdff324a9f9605d99697215a0d21c360fe8dfa8471bab
|
||||
</span></code></pre></div><blockquote>
|
||||
<p>If you’re having an issue pulling images, you may need to remove <code>~/.docker/config.json</code> or remove the set of auths in the configuration as mentioned <a href=https://stackoverflow.com/a/69121873/1191286>here</a>.</p>
|
||||
</blockquote>
|
||||
<p>and then run and exec into the container:</p>
|
||||
<pre tabindex=0><code class=language-console data-lang=console>$ podman run --rm -ti alpine
|
||||
Error: error preparing container 99ace1ef8a78118e178372d91fd182e8166c399fbebe0f676af59fbf32ce205b for attach: error configuring network namespace for container 99ace1ef8a78118e178372d91fd182e8166c399fbebe0f676af59fbf32ce205b: error adding pod unruffled_bohr_unruffled_bohr to CNI network "podman": unexpected end of JSON input
|
||||
</code></pre><p>What does this error mean? A bit of searching lead to <a href=https://github.com/containers/podman/issues/11837>this github issue</a>.</p>
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-console data-lang=console><span style=color:#009;font-weight:700>$ </span>podman run --rm -ti alpine
|
||||
<span style=color:#aaa>Error: error preparing container 99ace1ef8a78118e178372d91fd182e8166c399fbebe0f676af59fbf32ce205b for attach: error configuring network namespace for container 99ace1ef8a78118e178372d91fd182e8166c399fbebe0f676af59fbf32ce205b: error adding pod unruffled_bohr_unruffled_bohr to CNI network "podman": unexpected end of JSON input
|
||||
</span></code></pre></div><p>What does this error mean? A bit of searching lead to <a href=https://github.com/containers/podman/issues/11837>this github issue</a>.</p>
|
||||
<p>Until the fix is released, a workaround is to just specify a port (even when it’s not needed):</p>
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-sh data-lang=sh>podman run -p <span style=color:#f60>4242</span> --rm -ti alpine
|
||||
</code></pre></div><p>If you’re reading this from the future, there is a good chance specifying a port won’t be needed.</p>
|
||||
@@ -212,24 +212,24 @@ Error: error preparing container 99ace1ef8a78118e178372d91fd182e8166c399fbebe0f6
|
||||
</span><span style=color:#c30> command: [/bin/echo, 'Hello world']
|
||||
</span><span style=color:#c30>EOF</span>
|
||||
</code></pre></div><p>Now run:</p>
|
||||
<pre tabindex=0><code class=language-console data-lang=console>$ podman-compose up
|
||||
podman pod create --name=davegallant.github.io --share net
|
||||
40d61dc6e95216c07d2b21cea6dcb30205bfcaf1260501fe652f05bddf7e595e
|
||||
0
|
||||
podman create --name=davegallant.github.io_hello_world_1 --pod=davegallant.github.io -l io.podman.compose.config-hash=123 -l io.podman.compose.project=davegallant.github.io -l io.podman.compose.version=0.0.1 -l com.docker.compose.container-number=1 -l com.docker.compose.service=hello_world --add-host hello_world:127.0.0.1 --add-host davegallant.github.io_hello_world_1:127.0.0.1 ubuntu /bin/echo Hello world
|
||||
Resolved "ubuntu" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
|
||||
Trying to pull docker.io/library/ubuntu:latest...
|
||||
Getting image source signatures
|
||||
Copying blob sha256:f3ef4ff62e0da0ef761ec1c8a578f3035bef51043e53ae1b13a20b3e03726d17
|
||||
Copying blob sha256:f3ef4ff62e0da0ef761ec1c8a578f3035bef51043e53ae1b13a20b3e03726d17
|
||||
Copying config sha256:597ce1600cf4ac5f449b66e75e840657bb53864434d6bd82f00b172544c32ee2
|
||||
Writing manifest to image destination
|
||||
Storing signatures
|
||||
1a68b2fed3fdf2037b7aef16d770f22929eec1d799219ce30541df7876918576
|
||||
0
|
||||
podman start -a davegallant.github.io_hello_world_1
|
||||
Hello world
|
||||
</code></pre><p>This should more or less provide the same results you would come to expect with docker. The README does clearly state that podman-compose is under development.</p>
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-console data-lang=console><span style=color:#009;font-weight:700>$ </span>podman-compose up
|
||||
<span style=color:#aaa>podman pod create --name=davegallant.github.io --share net
|
||||
</span><span style=color:#aaa>40d61dc6e95216c07d2b21cea6dcb30205bfcaf1260501fe652f05bddf7e595e
|
||||
</span><span style=color:#aaa>0
|
||||
</span><span style=color:#aaa>podman create --name=davegallant.github.io_hello_world_1 --pod=davegallant.github.io -l io.podman.compose.config-hash=123 -l io.podman.compose.project=davegallant.github.io -l io.podman.compose.version=0.0.1 -l com.docker.compose.container-number=1 -l com.docker.compose.service=hello_world --add-host hello_world:127.0.0.1 --add-host davegallant.github.io_hello_world_1:127.0.0.1 ubuntu /bin/echo Hello world
|
||||
</span><span style=color:#aaa>Resolved "ubuntu" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
|
||||
</span><span style=color:#aaa>Trying to pull docker.io/library/ubuntu:latest...
|
||||
</span><span style=color:#aaa>Getting image source signatures
|
||||
</span><span style=color:#aaa>Copying blob sha256:f3ef4ff62e0da0ef761ec1c8a578f3035bef51043e53ae1b13a20b3e03726d17
|
||||
</span><span style=color:#aaa>Copying blob sha256:f3ef4ff62e0da0ef761ec1c8a578f3035bef51043e53ae1b13a20b3e03726d17
|
||||
</span><span style=color:#aaa>Copying config sha256:597ce1600cf4ac5f449b66e75e840657bb53864434d6bd82f00b172544c32ee2
|
||||
</span><span style=color:#aaa>Writing manifest to image destination
|
||||
</span><span style=color:#aaa>Storing signatures
|
||||
</span><span style=color:#aaa>1a68b2fed3fdf2037b7aef16d770f22929eec1d799219ce30541df7876918576
|
||||
</span><span style=color:#aaa>0
|
||||
</span><span style=color:#aaa>podman start -a davegallant.github.io_hello_world_1
|
||||
</span><span style=color:#aaa>Hello world
|
||||
</span></code></pre></div><p>This should more or less provide the same results you would come to expect with docker. The README does clearly state that podman-compose is under development.</p>
|
||||
<h3 id=summary>Summary</h3>
|
||||
<p>Installing Podman on macOS was not seamless, but it was manageable well within 30 minutes. I would recommend giving Podman a try to anyone who is unhappy with experiencing forced docker updates, or who is interested in using a more modern technology for running containers.</p>
|
||||
<p>One caveat to mention is that there isn’t an official graphical user interface for Podman, but there is an <a href=https://github.com/containers/podman/issues/11494>open issue</a> considering one. If you rely heavily on Docker Desktop’s UI, you may not be as interested in using podman yet.</p>
|
||||
|
Reference in New Issue
Block a user