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.
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 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 "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 images
After 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 images
After 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