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

Steps to purchase a cloud server and install the Pagoda Panel on Alibaba Cloud

Alibaba Cloud purchases servers Purchase a cloud ...

Linux editing start, stop and restart springboot jar package script example

Preface In the springboot configuration file, the...

Introduction to the role of HTML doctype

Document mode has the following two functions: 1. ...

IE8 uses multi-compatibility mode to display web pages normally

IE8 will have multiple compatibility modes . IE pl...

Detailed explanation of node.js installation and HbuilderX configuration

npm installation tutorial: 1. Download the Node.j...

MySQL GTID comprehensive summary

Table of contents 01 Introduction to GTID 02 How ...

Implementation of proxy_pass in nginx reverse proxy

The format is simple: proxy_pass URL; The URL inc...

Detailed explanation of the use of CSS3 rgb and rgba (transparent color)

I believe everyone is very sensitive to colors. C...

jQuery uses the canvas tag to draw the verification code

The <canvas> element is designed for client...

Learn the operating mechanism of jsBridge in one article

Table of contents js calling method Android 1.js ...

30 excellent examples of color matching in web design

Today, this article has collected 30 excellent cas...

Docker exec executes multiple commands

The docker exec command can execute commands in a...