-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Darren Wong
committed
Oct 17, 2023
1 parent
1713a0d
commit 8727595
Showing
3 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
data-science-programming/other/docker/7 DK Distributing Docker Images.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#course_datacamp-docker #docker | ||
|
||
- Summary of covered commands: | ||
|
||
| Command | Usage | | ||
| ------------------------------------------- | --------------------------------------------------- | | ||
| `docker pull <private-registry-url>/<image-name>:<ver>` | Pull an image from a private registry | | ||
| `docker tag <image-name>:<ver> <private-registry-url>/<image-name>:<ver>` | Rename an image for pushing to a private registry | | ||
| `docker image push <image-name>` | Push an image to a registry | | ||
| `docker login <private-registry-url>` | Authenticate with a private registry | ||
| `docker save -o <file-name>.tar <image-name>` | Save an image to a local file | | ||
| `docker load -i <file-name>.tar` | Load an image from a local file | | ||
## Private registries | ||
|
||
- Images are distributed through the Docker Hub but images can be hosted privately in private registry servers as well. You can tell that an image is from a private registry as the name will start with the URL of the registry. | ||
- You pull these the same way as you pull any other image. | ||
|
||
```shell | ||
docker pull <private-registry-url>/<image-name>:<ver> | ||
``` | ||
|
||
## Pushing to a registry | ||
|
||
- To push an image to a registry run `docker image push <image-name>`. To direct it to a private registry, we need to rename the image and prepend the URL of the private repository with `docker tag`. We can then run `docker image push <new-image-name>`. | ||
|
||
```shell | ||
docker image push <image-name> | ||
docker tag <image-name>:<ver> <private-registry-url>/<image-name>:<ver> | ||
``` | ||
|
||
## Authenticating with a private registry | ||
|
||
- Docker Hub images can be pulled without authentication, but private registries may be set up to require it. We can do this with `docker login <private-registry-url>`. | ||
|
||
## Docker images as files | ||
|
||
- If we want to pass an image around to only a small number of people, we can save it as a file with `docker save`. You can then load it with `docker load`. | ||
|
||
```shell | ||
docker save -o <file-name>.tar <image-name> | ||
docker load -i <file-name>.tar | ||
``` |
Binary file added
BIN
+88.6 KB
data-science-programming/other/docker/attachments/Pasted image 20231017212110.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.