I was helping a customer build some customized automation tasks using vRealize Automation Codestream. These tasks required the use of a container image with certain tools installed, usually we can include a CI task to download the tools into the container image on the fly. However, my customer’s environment is offline, so I needed to provide them a container image with everything installed by default.
Before we dive into the process of running a container and committing the changes, it is recommended where possible to create a new docker file that would build your docker image as needed with the associated commands such as the below:
FROM node:12-alpine RUN apk add --no-cache python g++ make WORKDIR /app COPY . . RUN yarn install --production CMD ["node", "src/index.js"]
Committing changes to a container image in this way can cause the image to become bloated. But sometimes there’s a need to do just do it this way.
Prerequisites
Pull the image you want to update
docker pull {image location/name}
Check your images and get the ID
docker images
For the next command, we will need the Image ID.
Run your image as an active container
docker run -it {Image_ID} /bin/bash
This will then drop you into the tty of the running container.
Modify your container
Continue reading Using Docker to update and commit to a container image