[Artifactory] How to use Docker repository

Artifactory Docker repository

There are various repository types available for the repository management service called Artifactory, but this time I will show you how to use one of them, Docker. Docker is one of the open source software for container virtualization, and can be managed for each software or service.

Advance preparation

In order to use the Docker repository, you need to install Docker on the client side. If you want to use Docker on Windows or Mac, download the here client software. Execute the following command on CentOS (Linux).

yum install docker

After installation, start Docker with the following command.

systemctl start docker

Now that Docker is ready for trial, it's time to get (Pull) the Docker test image "hello-world". Execute the following command to get it.

docker pull hello-world

If the following message is displayed after execution, the process is complete.
Status: Downloaded newer image for docker.io/hello-world:latest

After getting the "hello-world" image, execute the `` `docker images``` command and you will see the following result.

REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
docker.io/hello-world   latest              bf756fb1ae65        12 months ago       13.3 kB

Push images to Docker repository

Push the "hello-world" image you got earlier to the Docker repository on Artifactory. First, execute the following command to log in to the target Docker repository.

docker login <FQDN of Artifactory>

Username:<Login user name to Artifactory>
Password:<Login password to Artifactory>

After logging in, push the image to the Docker repository, but before that, tag the image you want to push. The command is:

docker tag <Target docker image ID> <FQDN of Artifactory>/<Docker repository name>/<Target docker image name>:<Tag name>

<Target docker image ID>Enter the IMAGE ID displayed by the "docker images" command.
<Target docker image name>Is the image name to be pushed (hello in this case)-world)
<Tag name>Is optional

If you execute `` `docker images``` again after tagging, the repository will be added as follows.

REPOSITORY                                            TAG                 IMAGE ID            CREATED             SIZE
docker.io/hello-world                                 latest              bf756fb1ae65        12 months ago       13.3 kB
<FQDN of Artifactory>/<Docker repository name>/hello-world   <Set tag name>               bf756fb1ae65        12 months ago       13.3 kB

In this state, push to Artifactory. The command is:

docker push <FQDN of Artifactory>/<Docker repository name>/<Target docker image name>:<Set tag name>

Complete when the following content is displayed after executing the above command.
Pushed
<Tag name>: digest: sha256:<abridgement>

Pull the pushed image

Pull the "hello-world" image you just pushed. Before that, delete the image remaining on the client. The command to delete the image is: Please note that it is specified by the image ID written in a list of letters and numbers.

docker rmi <Image ID>

* Use the above command to "hello"-When I try to delete the "world" image, I get an "Error response from daemon": conflict: unable to delete bf756fb1ae65 (must be forced) -I got the error "image is referenced in multiple repositories".
In that case"-Add the "f" option and force delete.
* Before executing forced deletion, execute the following command to check if the process to be deleted has been started just in case.
docker ps -a

docker imagesAfter confirming that the image to be pulled is not displayed by executing, pull the image from the following command.

docker pull <FQDN of Artifactory>/<Docker repository name>/<Target docker image name>:<Set tag name>

If the following message is displayed after execution, the process is complete.
Status: Downloaded newer image for <FQDN of Artifactory>/<Docker repository name>/<Target docker image name>:<Set tag name>

docker imagesAfter executing, the following result will be displayed.

REPOSITORY                                            TAG                 IMAGE ID            CREATED             SIZE
<FQDN of Artifactory>/<Docker repository name>/<Target docker image name>   <Set tag name>               bf756fb1ae65        12 months ago       13.3 kB

This completes how to use Artifactory's Docker repository.

Recommended Posts

[Artifactory] How to use Docker repository
[Rails] How to use rails console with docker
How to use Docker in VSCode DevContainer
Understand in 5 minutes !! How to use Docker
How to use Map
How to use rbenv
How to use letter_opener_web
How to use with_option
How to use fields_for
How to use java.util.logging
How to use map
How to use collection_select
How to use Twitter4J
How to use active_hash! !!
How to install Docker
How to use MapStruct
How to use hidden_field_tag
How to use TreeSet
[How to use label]
How to use identity
How to use hashes
How to use JUnit 5
How to use Dozer.mapper
How to use Gradle
How to use org.immutables
How to use java.util.stream.Collector
How to use VisualVM
How to use Map
How to use docker compose with NVIDIA Jetson
How to use nginx-ingress-controller with Docker for Mac
[Java] How to use Map
How to use Chain API
How to use java Optional
How to use JUnit (beginner)
How to use Ruby return
[Rails] How to use enum
How to use @Builder (Lombok)
[Swift] How to use UserDefaults
How to use java class
How to use Swift UIScrollView
How to use Big Decimal
[Java] How to use Optional ②
[Java] How to use removeAll ()
How to set Docker nginx
How to use String [] args
[Java] How to use string.format
How to use rails join
How to use Java Map
How to use dependent :: destroy
How to use Eclipse Debug_Shell
How to use Apache POI
[Rails] How to use validation
How to use Java variables
[Rails] How to use authenticate_user!
[Rails] How to use "kaminari"
How to use GC Viewer
[Java] How to use Optional ①
How to use Lombok now
[Creating] How to use JUnit
[Rails] How to use Scope
How to use In-Memory Job repository in Spring Batch