Jump to content

Edit docker image

From Costa's Wiki
Revision as of 18:26, 14 August 2024 by 10.0.0.200 (talk) (Created page with " # Run an existing image docker run -dt existing_image # See that it's running docker ps # CONTAINER ID IMAGE COMMAND CREATED STATUS...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
# Run an existing image
docker run -dt existing_image 

# See that it's running
docker ps
# CONTAINER ID   IMAGE            COMMAND   CREATED              STATUS              
# c7e6409a22bf   existing-image   "R"       6 minutes ago        Up 6 minutes

# Shell into it
docker exec -it c7e6409a22bf bash

# Make a new directory for demonstration purposes
# (note that this is inside the existing image)
mkdir NEWDIRECTORY

# Open another terminal tab/window, and save the running container you modified
docker commit c7e6409a22bf 10.0.0.26:49154/my-new-image:stable 

# Inspect to ensure it saved correctly
docker image ls
# REPOSITORY           TAG       IMAGE ID       CREATED         SIZE
# existing-image       latest    a7dde5d84fe5   7 minutes ago   888MB
# my-new-image         latest    d57fd15d5a95   2 minutes ago   888MB
 
docker push 10.0.0.26:49154/my-new-image:stable