From bc32bc88ca3880b51ddd413dfe0e7ec789be18c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=93=E6=9D=B0?= <87080562+xiao-jay@users.noreply.github.com> Date: Sat, 14 Jan 2023 00:11:16 +0800 Subject: [PATCH] docs:pull private image tutorial (#2404) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 晓杰 <2561589453@qq.com> --- .../zh-Hans/examples/pull-private-image.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 docs/4.0/i18n/zh-Hans/examples/pull-private-image.md diff --git a/docs/4.0/i18n/zh-Hans/examples/pull-private-image.md b/docs/4.0/i18n/zh-Hans/examples/pull-private-image.md new file mode 100644 index 000000000..b3eb67799 --- /dev/null +++ b/docs/4.0/i18n/zh-Hans/examples/pull-private-image.md @@ -0,0 +1,60 @@ +# 在sealos-cloud 上面拉取私有镜像教程 + +## 1、在sealos-cloud上面创建docker hub secret + +``` +kubectl create secret docker-registry regcred \ + --docker-server=<你的镜像仓库服务器> \ //docker hub的话是https://index.docker.io/v1/ + --docker-username=<你的用户名> \ + --docker-password=<你的密码> \ + --docker-email=<你的邮箱地址> +``` + + + +## 2、创建pod + +2.1上传一个镜像,并且在docker hub上面从public修改为private + +``` +docker pull hellodm/my-first-demo:v1.0 +docker tag 375fb2abe5d4 xiaojie99999/my-first-demo:v1.0 +docker push xiaojie99999/my-first-demo:v1.0 +``` + +2.2 creat a pod,在sealos cloud 上面的terminal里面apply这个yaml + +``` +apiVersion: v1 +kind: Pod +metadata: + name: my-first-demo + labels: + app: my-first-demo +spec: + containers: + - name: my-first-demo + image: xiaojie99999/my-first-demo:v1.0 + ports: + - containerPort: 80 + resources: + requests: + cpu: 0.1 + memory: 32Mi + limits: + cpu: 0.5 + memory: 32Mi + imagePullSecrets: + - name: regcred +``` + +## 3、结果 + +``` +root@t5bha6vem:~# kubectl get pod +NAME READY STATUS RESTARTS AGE +my-first-demo 1/1 Running 0 8m56s +``` + + +