Jump to content

Edit docker image

From Costa's Wiki
# 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