How do you create a new image in a container without using a dockerfile?

Devops Devops in Devops . 3 years ago

  1   0   0   0   0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Install a new package in a container

docker run -it ubuntu root@851edd8fd83a:/# which yum --returns nothing root@851edd8fd83a:/# apt-get update root@851edd8fd83a:/# apt-get install -y yum root@851edd8fd83a:/# which yum /usr/bin/yum --Get the LATEST container id CONTAINER ID        IMAGE  COMMAND   CREATED STATUS                        PORTS NAMES 851edd8fd83a        ubuntu  "/bin/bash"   6 minutes ago Exited (127) 3 minutes ago                         --base image changed docker diff 851edd8fd83a

Commit the changes in the container to create a new image.

Divya1@Divya:~ $docker commit 851edd8fd83a mydocker/ubuntu_yum sha256:630004da00cf8f0b8b074942caa0437034b0b6764d537a3a20dd87c5d7b25179

--List if the new image is listed

Divya1@Divya:~ $docker images REPOSITORY            TAG IMAGE ID            CREATED SIZE mydocker/ubuntu_yum   latest 630004da00cf        20 seconds ago 256MB

Posted on 31 May 2022, this text provides information on Devops related to Devops in Devops. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Tuteehub forum answer Answers

Post Answer

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.