The first step to creating an image is to create a container and fill it with some data.
First we'll create a container with a single new file based off of the busybox
base image:
sudo
docker run busybox echo "fun" > newfile
The container will immediately terminate (because its one command is echo
), so we'll use docker ps -l
to list it:
sudo
docker ps -l
CONTAINER ID IMAGE COMMAND CREATED
07f2065197ef busybox:latest echo fun 31 seconds ago