# 上傳到公有倉庫

公有倉庫指的是[Docker Hub](https://hub.docker.com/)，這裡有上百萬的映像檔供搜尋使用。

![](/files/-MDICcIY7ixuf9oFsrcP)

建議在使用時儘量尋&#x627E;**`官方`**&#x6216;**`驗證的發行者`**&#x63D0;供的映像檔，避免映像檔中夾帶著危及安全的程式碼及病毒。

![](/files/-MDIDKvp8A2ZIdYQdzcY)

{% hint style="warning" %}
**Docker Hub/Github等均為公共空間，請避免上傳與公司相關或機密的程式。**
{% endhint %}

Docker Push到公用倉庫Docker Hub

* Docker Login

```
$ docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: cutejaneii
Password: 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
```

* Docker Tag：在推送到自己的repository之前，要先tag

```
$ docker tag myapp cutejaneii/myapp
$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
cutejaneii/myapp    latest              7aba68965779        40 minutes ago      696MB
myapp               latest              7aba68965779        40 minutes ago      696MB
```

* Docker Push

```
$ docker push cutejaneii/myapp
The push refers to repository [docker.io/cutejaneii/myapp]
4e5b25e56255: Pushed 
27ca79121151: Pushed 
e1a81b1589ce: Pushed 
f8093b983c20: Pushed 
ebac8a5e2f5b: Pushed 
ebd94299f5d0: Pushed 
ff1c70957ceb: Pushed 
1bb42387f7cb: Pushed 
94119923fb5e: Pushed 
a11003618325: Pushed 
668c51fd0cef: Pushed 
latest: digest: sha256:cd0d1e36474560d95f081fb96efe9d3182802a196a89fd9b2f617b058515d807 size: 2635
```

成功後在Docker Hub上就可以看到這個映像檔

![](/files/-MDIBkHN2NUWd74G2MMC)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cutejaneii.gitbook.io/docker/docker-registry/shang-chuan-dao-gong-you-cang-ku.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
