

Here, 5976e4ae287c represents the container ID and ubuntu-nginx represents the name of the new image that has been saved with committed changes. # docker ps -lĪnd apply changes by running the below command: # docker commit 5976e4ae287c ubuntu-nginx Next, after Nginx package is installed, issue the command docker ps -l to get the ID or name of the running container. If you get error ‘ E: Unable to locate package nginx‘, then you need to connect to a container with interactive CLI and install nginx as shown. # docker run ubuntu bash -c "apt-get -y install nginx" But before committing any changes to a container, first start the container with the below commands which updates and installs Nginx daemon into Ubuntu image: # docker run ubuntu bash -c "apt-get -y update" In this example, we will run and save an Ubuntu-based Docker container where the Nginx server will be installed.

