joi, 27 martie 2025

How to Modify a File Inside a Running Docker Container

Let's assume we need to modify the file logback-spring.xml inside the container bb9d1daac389.

docker exec -it bb9d1daac389 sh
# cd /app
# vim logback-spring.xml
/bin/sh: 1: vim: not found
# apt update
# apt install vim
# vim logback-spring.xml
If the container is not based on an Ubuntu image, you can check the OS using cat /etc/os-release and use the corresponding package manager, such as apt, pacman, or another appropriate tool.

Niciun comentariu:

Trimiteți un comentariu