How to modify the contents of an existing Docker container

How to modify the contents of an existing Docker container

1. Docker ps lists containers

2. Docker cp copies files to the container

Note: How to copy and transfer files between the host and the container in Docker

1. Copy files from the container to the host

docker cp mycontainer:/opt/testnew/file.txt /opt/test/

2. Copy files from the host to the container

docker cp /opt/test/file.txt mycontainer:/opt/testnew/

It should be noted that the copy command will take effect regardless of whether the container is started or not.

When we are finished, we exit using exit and now that our container has been modified, we commit the updated copy using the docker commit command.

3. Submit changes

$ sudo docker commit -m "description content" -a "author name" 32555789dd00 aipaper/devinz83:v2

Among them, -m specifies the submission description information, just like the version control tool we use; -a can specify the updated user information; followed by the ID of the container used to create the image; and finally, the warehouse name and tag information of the target image are specified. After successful creation, the image ID information will be returned.

4. Use docker images to view the newly created image.

docker images 

5. Modify the yml file

Use the new image

6. Redeploy, that is, deploy the docker application using the newly modified image.

docker stack deploy --compose-file=/opt/docker/yml/docker-compose-resty-redis.yml resty_redis

Attachment: Lua script that can add redis cluster password, portal.

This is the end of this article about how to modify the contents of an existing docker container. For more information about how to modify the contents of a docker container, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • 5 ways to migrate Docker containers to other servers
  • Docker - Summary of 3 ways to modify container mount directories
  • How to view files in Docker image
  • docker cp copy files and enter the container

<<:  Vue uniapp realizes the segmenter effect

>>:  IE conditional comments for XHTML

Recommend

In-depth explanation of the maximum value of int in MySQL

Introduction I will write about the problem I saw...

How to change the terminal to a beautiful command line prompt in Ubuntu 18

I reinstalled VMware and Ubuntu, but the command ...

JavaScript implements double-ended queue

This article example shares the specific code of ...

Implementation of CentOS8.0 network configuration

1. Differences in network configuration between C...

Example of how to create and run multiple MySQL containers in Docker

1. Use the mysql/mysql-server:latest image to qui...

MySQL 5.6.36 Windows x64 version installation tutorial detailed

1. Target environment Windows 7 64-bit 2. Materia...

Pitfalls and solutions for upgrading MySQL 5.7.23 in CentOS 7

Preface Recently, I found a pitfall in upgrading ...

How to handle token expiration in WeChat Mini Programs

Table of contents Conclusion first question Solut...

Docker removes abnormal container operations

This rookie encountered such a problem when he ju...

JavaScript array deduplication solution

Table of contents Method 1: set: It is not a data...

MySQL Database Indexes and Transactions

Table of contents 1. Index 1.1 Concept 1.2 Functi...

Practice of using Tinymce rich text to customize toolbar buttons in Vue

Table of contents Install tinymce, tinymce ts, ti...

Configure Java development environment in Ubuntu 20.04 LTS

Download the Java Development Kit jdk The downloa...

Detailed explanation of Vue advanced construction properties

Table of contents 1. Directive custom directive 2...