Docker commit
Docker commit used to reate a new image from a container’s changes.
You need to commit the changes you make to the container and then run it. Try this example:
sudo docker pull debian
After pull image from docker hub, you can customize to fit your enviroment
in this example is just to try install apache2
sudo docker run debian apt-get update && apt-get install -y apache2
or you can access the bash with command:
sudo docker run debian
Check container id
sudo docker ps -l
Enter to the bash terminal
sudo docker exec -it <container_id> bash
apt-get update && apt-get install -y apache2
exit bash terminal
exit
Commit changes to the container:
sudo docker commit <container_id> nasohi/www1
Now the container becomes the image, check with the following command:
sudo docker images
Then run the container:
sudo docker run nasohi/www1
Another way is you can make docker file and use docker build
Read also:
https://nciptandani.blogspot.com/search?q=docker
References:
https://www.techrepublic.com/article/how-to-commit-changes-to-a-docker-image/
https://docs.docker.com/engine/reference/commandline/commit/
https://linuxize.com/post/how-to-build-docker-images-with-dockerfile/
You need to commit the changes you make to the container and then run it. Try this example:
sudo docker pull debian
After pull image from docker hub, you can customize to fit your enviroment
in this example is just to try install apache2
sudo docker run debian apt-get update && apt-get install -y apache2
or you can access the bash with command:
sudo docker run debian
Check container id
sudo docker ps -l
Enter to the bash terminal
sudo docker exec -it <container_id> bash
apt-get update && apt-get install -y apache2
exit bash terminal
exit
Commit changes to the container:
sudo docker commit <container_id> nasohi/www1
Now the container becomes the image, check with the following command:
sudo docker images
Then run the container:
sudo docker run nasohi/www1
Another way is you can make docker file and use docker build
Read also:
https://nciptandani.blogspot.com/search?q=docker
References:
https://www.techrepublic.com/article/how-to-commit-changes-to-a-docker-image/
https://docs.docker.com/engine/reference/commandline/commit/
https://linuxize.com/post/how-to-build-docker-images-with-dockerfile/
Komentar