Docker images

Contents
Introduction
images: List of images
pull: Download the image
Download a specific version of the image
Image repository hub.docker.com
save: Keep the image in the archive
load: Download image from archive
tag: Put the right image in.
push: Publication of images
Delete the image
Delete all images
Similar articles

Introduction

A Docker image is a read-only template used to create containers.

Images are used to store and send applications.

Instructions for working with Docker from Beget.com

docker images

A list of top-level images, their tags, sizes, and repositories can be obtained by

docker images

REPOSITORY TAG IMAGE ID CREATED SIZE andreyolegovichru/docker101tutorial latest dd2e76a16950 9 hours ago 26.8MB docker101tutorial latest dd2e76a16950 9 hours ago 26.8MB <none> <none> f5578f194936 9 hours ago 123MB <none> <none> 409d2b2d3c0b 9 hours ago 110MB <none> <none> c26bbf7dc236 9 hours ago 224MB python alpine fbfb63e3c6bb 17 hours ago 80.3MB nginx alpine ecd67fe340f9 4 days ago 21.6MB node 12-alpine 057fa4cc38c2 2 weeks ago 89.3MB hello-world latest bf756fb1ae65 6 months ago 13.3kB

Documentation.

Pull: Download images

With commands. pull You can download images without running them.

Download the image with Ubuntu

docker pull ubuntu

Using default tag: latest latest: Pulling from library/ubuntu 692c352adcf2: Pull complete 97058a342707: Pull complete 2821b8e766f4: Pull complete 4e643cc37772: Pull complete Digest: sha256:55cd38b70425947db71112eb5dddfa3aa3e3ce307754a3df2269069d2278ce47 Status: Downloaded newer image for ubuntu:latest docker.io/library/ubuntu:latest

Check if the images have been updated

docker images

REPOSITORY TAG IMAGE ID CREATED SIZE andreyolegovichru/docker101tutorial latest dd2e76a16950 19 hours ago 26.8MB docker101tutorial latest dd2e76a16950 19 hours ago 26.8MB <none> <none> f5578f194936 19 hours ago 123MB <none> <none> 409d2b2d3c0b 19 hours ago 110MB <none> <none> c26bbf7dc236 19 hours ago 224MB python alpine fbfb63e3c6bb 27 hours ago 80.3MB nginx alpine ecd67fe340f9 4 days ago 21.6MB ubuntu latest adafef2e596e 8 days ago 73.9MB node 12-alpine 057fa4cc38c2 2 weeks ago 89.3MB hello-world latest bf756fb1ae65 6 months ago 13.3kB

If you do not need the last image, but some specific version - specify it after the colon.

For example, if you need Ubuntu 14.04

docker pull ubuntu:14.04

This image can be removed by command rmi.

docker rmi ubuntu:14.04

You can delete it not by name, but using IMAGE ID, for example, if I want to delete the image. hello-world IMAGE ID bf756fb1ae65

docker rmi bf756fb1ae65

Image repository hub.docker.com

You can check the list of available images on the website hub.docker.com

We need to press the button. Explore top-down hub.docker.com/search

Installation of Docker in Windows 10 image from the website www.eth1.ru

The list is as follows:

Installation of Docker in Windows 10 image from the website www.eth1.ru

There are a lot of images, I recommend using search or filters. Docker Certified It means official image.

The official images of the names are indicated simply: debian , python , php and so on. This is called «Top Level Image».

If the source is not confirmed, for example, if I make an image, for example, an application for a website. TopBicycle.ru then the name will look like this: andreyolegovich/topbicycle-ru

That is, first the name of the author, then the name of the image. Not all companies verify images. For example, load testing software Yandex Tank laid out direvius/yandex-tank

Banner image

Save: Keep the image archived

If you need to save an image to a .tar file, for example, for transfer to another host

docker save aredelcom/aredel_browser_lite:27.0 > aredel_browser.tar

load: unload the image from the archive

If you get an image as a .tar file, you can unpack it. d d load

docker load < /opt/aredel/containers/aredel_browser.tar

Once uploaded, the image will have the original title, not the archive name.

docker images

REPOSITORY TAG IMAGE ID CREATED SIZE aredelcom/aredel_browser_lite 27.0 736bd91205de 9 hours ago 1.0GB

tag: substitute the desired image

Your software is used in a certain way. The name of this image is indicated in the settings, for example in a toml file. You need to replace it in a similar way, such as the next version.

In order not to constantly change the name in the settings, you can download the second image and substitute it. first command tag

docker images

REPOSITORY TAG IMAGE ID CREATED SIZE aredelcom/aredel_browser_lite 27.0 726bd91205de 9 hours ago 1.0GB aredel_browser latest 845d799ca1f0 3 weeks ago 1.04GB aredelcom/aredel_browser_lite 26.0 845d799ca1f0 3 weeks ago 1.04GB

The program uses the aredel browser image. At the moment, this image is version 26.0 - you can see by looking at it. identical IDs.

Version 27 can be replaced by command. tag

docker tag aredelcom/aredel_browser_lite:27.0 aredel_browser

REPOSITORY TAG IMAGE ID CREATED SIZE aredel_browser latest 726bd91205de 9 hours ago 1.00GB aredelcom/aredel_browser_lite 27.0 726bd91205de 9 hours ago 1.0GB aredelcom/aredel_browser_lite 26.0 845d799ca1f0 3 weeks ago 1.04GB

Publication of images in Docker Hub

First you need to create an account on a dockerhub, make a repository there. I called it jenkins-docker-slave. Because I make an image for an employee. Jenkins

You can log in to your account command. docker login

docker login --username=andreissh

Password:

WARNING! Your password will be stored unencrypted in /home/andrei/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded

I need to write. Dockerfile Build a command image build

An example of such a docker file you can study here

docker build -t jenkins-docker-slave:1.0 .

With commands. tag Prepare copies of the image with the name in format

repository/figure:version

docker tag jenkins-docker-slave:1.0 andreissh/jenkins-docker-slave:1.0
docker tag jenkins-docker-slave:1.0 andreissh/jenkins-docker-slave:latest
docker images

REPOSITORY TAG IMAGE ID CREATED SIZE andreissh/jenkins-docker-slave 1.0 0aebbb7255ed 5 minutes ago 915MB andreissh/jenkins-docker-slave latest 0aebbb7255ed 5 minutes ago 915MB jenkins-docker-slave 1.0 0aebbb7255ed 5 minutes ago 915MB

You can send an image to the dockerhab command docker push

docker push andreissh/jenkins-docker-slave:1.0

The push refers to repository [docker.io/andreissh/jenkins-docker-slave] 5e67247e476e: Pushed 5834b8278bb9: Pushed 6b4ad81eb09a: Pushed 1b0c531a1de3: Pushed 77f335c4dfa4: Pushed 3d9a7ec04e48: Pushed 6515074984c6: Mounted from library/ubuntu 1.0: digest: sha256:2986eb4bd51548889f2e6eaa18b649cfeef9d2a783811812f7771af56c1f61fd size: 1783

docker push andreissh/jenkins-docker-slave:latest

The push refers to repository [docker.io/andreissh/jenkins-docker-slave] 5e67247e476e: Layer already exists 5834b8278bb9: Layer already exists 6b4ad81eb09a: Layer already exists 1b0c531a1de3: Layer already exists 77f335c4dfa4: Layer already exists 3d9a7ec04e48: Layer already exists 6515074984c6: Layer already exists latest: digest: sha256:2986eb4bd51548889f2e6eaa18b649cfeef9d2a783811812f7771af56c1f61fd size: 1783

Images should appear at the hub

Jenkins-docker-slave image from www.eth1.ru
Images at hub.docker.com
www.eth1.ru

Delete the image

Deleting an image requires command

docker rmi image_id

Where image id is a full or partial image IMAGE ID.

docker rmi 07c45e16bf36

If IMAGE ID starts at 07c with only one, write

docker rmi 07c

You can remove the image by the name of Repository.

docker rmi jenkins_nginx_mkdocs-mkdocs:latest

Forced removal is done using the --force flag.

docker rmi --force 8d788d646766

Delete all images

Mass removal and stopping of containers and images dismantled here

Example Linux

docker rmi $(docker images -q)

Article author: Andrei Olegovich

Related articles
Docker images
Docker
Установка в Linux и Windows
Основы
build: Создание контейнеров + примеры
run: Опции запуска контейнера
Dockerfile
Остановить/удалить все контейнеры
exec: выполнить команду в контейнере
Установка docker compose в Linux
Видеоуроки
Ошибки

Search this site

Subscribe to Telegram channel @aofeed to follow new articles and updates to old ones

Go to channel

@aofeed

Ask a question in the Telegram group

@aofeedchat

Contacts and cooperation:
I recommend our hosting beget.ru
Write to info@urn.su, info@aredel.com if you:
1. Want to write an article for our site or translate an article into your native language.
2. Want to place thematically relevant ads on the site.
3. Ads on my site pass maximum censorship. If you see an ad block unsuitable for school-age children, shocking or misleading - please contact us by e-mail
4. Found a mistake, inaccuracy, bug, etc. on the site. ... .......
5. Articles can be shared on social media by clicking a network icon: