--- title: "Push and pull images" description: "Log in to a Container Registry project with Docker, push an image to it, and pull the image by its tag or its digest." content_type: "how-to" product: "container-registry" platform: "MyAccount" url: "/myaccount/container-registry/how-to/push-and-pull-images/" topic: ["create-and-connect"] relationships: {"requires":["/myaccount/container-registry/how-to/create-a-registry-project/","/myaccount/container-registry/how-to/create-an-access-token/"]} --- # Push and pull images Push images from your computer into a registry project, and pull them onto any machine that runs Docker. The registry address is `registry.e2enetworks.net`. The portal gives you each command with the address and your project's name filled in, so copy them from there. Each image you push is an artifact in its repository: one exact image, named by its digest, with any tags you gave it. ## Before you begin You need: - Docker installed on the machine you push from or pull to. - A registry project that reads **Created**. See [Create a registry project](/myaccount/container-registry/how-to/create-a-registry-project/). - An access token for the project, and its **Token Name** and **Token Value**. To push, the token needs **Push** checked; a token with only **Pull** suits machines that only pull. See [Create an access token](/myaccount/container-registry/how-to/create-an-access-token/). - A network that lets the machine reach both `registry.e2enetworks.net` and `objectstore.e2enetworks.net` over HTTPS. Docker talks to the registry, and the image layers download from the second address. ## Find the commands for your project In MyAccount, under **Storage**, click **Container Registry**, and click your project. On its **Repositories** tab, click **Push Commands**. **Docker Push Command** opens with three commands: - **Docker Login Command** logs Docker in to the registry with an access token. - **Tag an image for this project:** names a local image with the project's address. - **Push an image to this project:** sends the image to the project. On this page, `` stands for your project's name. ## Log in Copy the **Docker Login Command**. Replace the token name placeholder with the token's **Token Name** and the token value placeholder with its **Token Value**, and run it: ```bash docker login registry.e2enetworks.net -u -p ``` In a script or CI job, pass the value on standard input: ```bash echo "$REGISTRY_TOKEN" | docker login registry.e2enetworks.net -u --password-stdin ``` Here REGISTRY_TOKEN is a secret variable in your CI system that holds the **Token Value**, and `` is the **Token Name**. Docker prints `Login Succeeded`. With `-p`, it first warns that a password on the command line is insecure; `--password-stdin` avoids that. Log in once on each machine; Docker keeps the login. If it returns unauthorized, see [Troubleshooting Container Registry](/myaccount/container-registry/troubleshooting/container-registry/#docker-login-returns-unauthorized). ## Tag and push an image 1. List the images on your computer, and note the name and tag of the one to push: ```bash docker images ``` 2. Copy the **Tag an image for this project:** command. Replace the source image and its tag with the image's name and tag, and the repository and its tag with the name to keep it under in your project, such as `web:1.0`, and run it: ```bash docker tag SOURCE_IMAGE[:TAG] registry.e2enetworks.net//REPOSITORY[:TAG] ``` 3. Copy the **Push an image to this project:** command, fill in the same repository and tag, and run it: ```bash docker push registry.e2enetworks.net//REPOSITORY[:TAG] ``` `[:TAG]` means the tag is optional; without one, Docker uses `latest`. Leave out the square brackets. For example, to push your local image `web:1.0` to the project `cr-12345`: ```bash docker tag web:1.0 registry.e2enetworks.net/cr-12345/web:1.0 docker push registry.e2enetworks.net/cr-12345/web:1.0 ``` When the push finishes, Docker prints the tag with the image's digest. The image appears on the project's **Repositories** tab, in the repository you named. The first push to a new repository name creates that repository. Every image path has the project's name right after the registry address, as in `registry.e2enetworks.net/cr-12345/web:1.0`. If the push fails with `unauthorized to access repository`, see [Troubleshooting Container Registry](/myaccount/container-registry/troubleshooting/container-registry/#docker-push-fails-with-unauthorized-to-access-repository). ## Pull an image Log in on the machine you pull to, as in [Log in](#log-in). Then pull the image in either of two ways. To pull by the tag you pushed it with, run: ```bash docker pull registry.e2enetworks.net//: ``` `` and `` are the name and tag you pushed the image with, such as `web` and `1.0`. To pull one exact artifact, whatever its tags point to later, pull it by its digest: 1. On the project's **Repositories** tab, click the repository's name. Its page opens on the **Info** tab. 2. The **Info** tab lists the repository's artifacts with their **Tags**, **Pull Command**, **Size** in MB, **Push Time**, and **Vulnerabilities**. To find an artifact, search for its tag. 3. Copy the artifact's **Pull Command**, and run it: ```bash docker pull registry.e2enetworks.net//@ ``` `` is the artifact's digest, already filled in for you. When the pull finishes, `docker images` lists the image. ## (Optional) See who pushed and pulled On the repository's page, open the **Logs** tab. The tab records Docker pushes and pulls by the project's current access tokens, one row each, with **Username**, **Resource**, **Resource Type**, **Operation**, and **Timestamp**. A push reads `create` under **Operation** and a pull reads `pull`, with the token's **Token Name** under **Username**. The tab shows the first 100 entries the registry returns for the whole project. You can now push and pull images with Docker. To run them on Kubernetes, see [Pull images from a Kubernetes pod](/myaccount/container-registry/how-to/pull-images-from-a-kubernetes-pod/). For errors, see [Troubleshooting Container Registry](/myaccount/container-registry/troubleshooting/container-registry/).