# 1.搜索,拉出和列出图像 $podman search hello-world INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED docker.io docker.io/library/hello-world Hello World! (an example of minimal Dockeriz... 1297 [OK]
$podman pull hello-world --log-level debug # 此处我已经进行加速镜像配置所以是从xlx9erfu.mirror.aliyuncs.com拉取(注意看其拉取过程) # DEBU[0000] GET https://xlx9erfu.mirror.aliyuncs.com/v2/ # DEBU[0000] Ping https://xlx9erfu.mirror.aliyuncs.com/v2/ status 200 # DEBU[0000] GET https://xlx9erfu.mirror.aliyuncs.com/v2/library/hello-world/manifests/latest
# --- Manifest List --- # DEBU[0008] Content-Type from manifest GET is "application/vnd.docker.distribution.manifest.list.v2+json" # DEBU[0008] Using blob info cache at /var/lib/containers/cache/blob-info-cache-v1.boltdb # DEBU[0008] Source is a manifest list; copying (only) instance sha256:90659bf80b44ce6be8234e6ff90a1ac34acbeb826903b02cfa0da11c82cbc042 for current system # DEBU[0008] GET https://xlx9erfu.mirror.aliyuncs.com/v2/library/hello-world/manifests/sha256:90659bf80b44ce6be8234e6ff90a1ac34acbeb826903b02cfa0da11c82cbc042
# --- Image Manifest --- # DEBU[0009] Content-Type from manifest GET is "application/vnd.docker.distribution.manifest.v2+json" # DEBU[0009] IsRunningImageAllowed for image docker:docker.io/library/hello-world:latest # DEBU[0009] Using default policy section # DEBU[0009] Requirement 0: allowed # DEBU[0009] Overall: allowed # DEBU[0009] Downloading /v2/library/hello-world/blobs/sha256:bf756fb1ae65adf866bd8c456593cd24beb6a0a061dedf42b26a993176745f6b # DEBU[0009] GET https://xlx9erfu.mirror.aliyuncs.com/v2/library/hello-world/blobs/sha256:bf756fb1ae65adf866bd8c456593cd24beb6a0a061dedf42b26a993176745f6b # Getting image source signatures # DEBU[0009] Manifest has MIME type application/vnd.docker.distribution.manifest.v2+json, ordered candidate list [application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.v1+prettyjws, application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.v1+json]
# --- Layers --- # DEBU[0009] Downloading /v2/library/hello-world/blobs/sha256:0e03bdcc26d7a9a57ef3b6f1bf1a210cff6239bff7c8cac72435984032851689 # DEBU[0009] GET https://xlx9erfu.mirror.aliyuncs.com/v2/library/hello-world/blobs/sha256:0e03bdcc26d7a9a57ef3b6f1bf1a210cff6239bff7c8cac72435984032851689 # DEBU[0010] Detected compression format gzip # Copying blob 0e03bdcc26d7 done # DEBU[0010] No compression detected
# --- 镜像ID --- # Copying config bf756fb1ae done # Writing manifest to image destination # Storing signatures # DEBU[0010] Applying tar in /var/lib/containers/storage/overlay/9c27e219663c25e0f28493790cc0b88bc973ba3b1686355f221c38a36978ac63/diff # DEBU[0010] setting image creation date to 2020-01-03 01:21:37.263809283 +0000 UTC # DEBU[0010] created new image ID "bf756fb1ae65adf866bd8c456593cd24beb6a0a061dedf42b26a993176745f6b" # DEBU[0010] set names of image "bf756fb1ae65adf866bd8c456593cd24beb6a0a061dedf42b26a993176745f6b" to [docker.io/library/hello-world:latest] # DEBU[0010] saved image metadata "{\"signatures-sizes\":{\"sha256:90659bf80b44ce6be8234e6ff90a1ac34acbeb826903b02cfa0da11c82cbc042\":[]}}" # DEBU[0010] parsed reference into "[overlay@/var/lib/containers/storage+/var/run/containers/storage]docker.io/library/hello-world:latest" # bf756fb1ae65adf866bd8c456593cd24beb6a0a061dedf42b26a993176745f6b
$podman images hello-world REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/library/hello-world latest bf756fb1ae65 8 months ago 20 kB
# 2.创建pod(与K8s中含义一致)和查看pod $ podman pull mirrorgcrio/pause:3.2 && podman tag docker.io/mirrorgcrio/pause:3.2 k8s.gcr.io/pause:3.2 # 创建pod前拉取k8s.gcr.io中pause应用组件(唯一与docker不同的地方) $ podman pod create --name HelloWorld # 73c5a062cb17b5088072ec13c496c101b0b239f9aba1dcad93ba5d746cdfb12d $ podman pod ls # POD ID NAME STATUS CREATED OF CONTAINERS INFRA ID(下文ID) # 73c5a062cb17 HelloWorld Created 29 seconds ago 1 15e7d3797552 $ podman container ls -a # 当前POD运行的容器 # CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES # 15e7d3797552 docker.io/mirrorgcrio/pause:3.2 About a minute ago Created 73c5a062cb17-infra
# 3.在pod中创建并运行容器 $ podman run --pod HelloWorld hello-world # hello-world镜像无后台程序所以无法后台运行 2fd059b66fb640393394e82404ed895e6a44673e7b1061ade81c1ae2e25e37fb $ podman logs 2fd059b66 # 将会看见我们最熟悉的Hello-World # Hello from Docker! # This message shows that your installation appears to be working correctly. # ....
# 4.运行在pod中container查看 $ podman ps -ap # CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES POD ID PODNAME # 15e7d3797552 docker.io/mirrorgcrio/pause:3.2 6 minutes ago Up 2 minutes ago 73c5a062cb17-infra 73c5a062cb17 HelloWorld # 2fd059b66fb6 docker.io/library/hello-world:latest /hello 2 minutes ago Exited (0) 2 minutes ago friendly_neumann 73c5a062cb17 HelloWorld # 退出的容器
podman ps --size --pod # 此处没有直接运行在pod中可以看见PODID与PODNAME为空 # CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES POD ID PODNAME SIZE # b466e555f6f1 docker.io/library/nginx:alpine nginx -g daemon o... 2 hours ago Up 2 hours ago hugoblog 1.12kB (virtual 22.1MB) # c18c914654ac docker.io/envoyproxy/envoy-alpine:latest envoy -c /etc/env... 2 hours ago Up 2 hours ago hugoblog-envoy 0B (virtual 52.9MB)
root@ubuntu:~# curl https://demo.weiyigeek.top --insecure <h3 style="color:red">WeiyiGeek Blog , Example Podman pod Create Nginx and Envoy and EnvoyProxy!</h3>
sudo tee /etc/systemd/system/Blog.service <<'EOF' [Unit] Description=WeiyiGeek-Blog-Service After=network.target After=network-online.target After=podman.service [Service] Type=simple ExecStart=/usr/bin/podman pod start Blog ExecStop=/usr/bin/podman pod stop -t 10 Blog KillMode=none Type=forking
问题描述: 首次执行 podman pod create –name HelloWorld 时候会出现以下错误;
1 2
ERRO[0060] Error freeing pod lock after failed creation: no such file or directory Error: error adding Infra Container: unable to pull k8s.gcr.io/pause:3.2: Error initializing source docker://k8s.gcr.io/pause:3.2: error pinging docker registry k8s.gcr.io: Get "https://k8s.gcr.io/v2/": dial tcp 108.177.97.82:443: i/o timeout
解决方式:
1 2 3 4 5 6 7 8 9 10
$podman pull mirrorgcrio/pause:3.2 --log-level info $podman images # REPOSITORY TAG IMAGE ID CREATED SIZE # docker.io/mirrorgcrio/pause 3.2 80d28bedfe5d 7 months ago 686 kB # docker.io/library/hello-world latest bf756fb1ae65 8 months ago 20 kB $podman tag docker.io/mirrorgcrio/pause:3.2 k8s.gcr.io/pause:3.2 $podman images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/mirrorgcrio/pause 3.2 80d28bedfe5d 7 months ago 686 kB k8s.gcr.io/pause 3.2 80d28bedfe5d 7 months ago 686 kB
方式1.请访问本博主的B站【WeiyiGeek】首页关注UP主, 将自动随机获取解锁验证码。
Method 2.Please visit 【My Twitter】. There is an article verification code in the homepage.
方式3.扫一扫下方二维码,关注本站官方公众号
回复:验证码
将获取解锁(有效期7天)本站所有技术文章哟!