Detailed explanation of the use of Docker commit

Detailed explanation of the use of Docker commit

Sometimes you need to install certain dependencies in the base image. If you write the commands in the Dockerfile, some dependent software will download very slowly, and it will take a long time to build the image. So it is best to install a new image that contains the dependent libraries.

Docker provides commit to achieve

For example, I have a python image, which is relatively streamlined. The two dependencies freetds-dev and unixodbc-dev are missing.

1. Run the image first

docker run -it --name python docker.io/python:3.6.4 /bin/bash

/bin/bash enters the container to interact

2. Execute the installation command

root@39eaa5aa7332:/code# apt-get install freetds-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
root@39eaa5aa7332:/code# apt-get install unixodbc-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done

After the installation is complete, press ctrl+p+q to exit the container.

3. Package the container into an image and execute docker commit

[root@CentOS ~]# docker commit 39eaa5aa7332 python3.6.4-dev
sha256:ca46b1ed99abc1338881a55a043ee9670a66601530b3f2e63f41eb949b91e84d

Then execute docker images to see this image

The above is a detailed explanation of the use of Docker commit. For more information about the use of Docker commit, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • Detailed explanation of the working principle and usage of the Docker image submission command commit
  • Docker learning notes: How to commit a container to an image
  • Detailed explanation of Docker modifying existing images (commit)
  • Detailed explanation of Docker learning to create an image using the commit command

<<:  Detailed explanation of the idea of ​​using mysqldump+expect+crontab to implement mysql periodic cold backup in linux

>>:  Let's talk about the Vue life cycle in detail

Recommend

HTML form application includes the use of check boxes and radio buttons

Including the use of check boxes and radio buttons...

Explanation on whether to choose paging or loading in interactive design

The author of this article @子木yoyo posted it on hi...

How to configure Nginx's anti-hotlinking

Experimental environment • A minimally installed ...

Example of using @media responsive CSS to adapt to various screens

Definition and Use Using @media queries, you can ...

Some slightly more complex usage example codes in mysql

Preface I believe that the syntax of MySQL is not...

MySQL 5.7.17 installation and configuration tutorial under Linux (Ubuntu)

Preface I have installed MySQL 5.6 before. Three ...

Element-ui's built-in two remote search (fuzzy query) usage explanation

Problem Description There is a type of query call...

Free tool to verify that HTML, CSS and RSS feeds are correct

One trick for dealing with this type of error is t...

The use and difference between JavaScript pseudo-array and array

Pseudo-arrays and arrays In JavaScript, except fo...

js to implement file upload style details

Table of contents 1. Overview 2. Parameters for c...

Detailed steps to install mysql5.7.18 on Mac

1. Tools We need two tools now: MySQL server (mys...

Comprehensive analysis of isolation levels in MySQL

When the database concurrently adds, deletes, and...

Detailed examples of variable and function promotion in JavaScript

js execution Lexical analysis phase: includes thr...

Summary of standard usage of html, css and js comments

Adding necessary comments is a good habit that a ...