- Comprehensive Blog on Dockers running on OCI
- running a Docker Container on OCI
- opening OCI Ports for Docker Containers
- Building a Docker Image by using Dockerfile
- Committing changes made in a Docker without using Dockerfile
- Pushing Docker Images to Docker Hub
- DevOps with Github, Docker Hub and Oracle Container Cloud Services
Goal
Sometimes you might want to do complex operations which might need you get the base image and then update changes and commit , typical example would be creating a tomcat image , deploying your war file and then committing the changes by tagging a particular version.
Spin up a container
[email protected]:~$ docker run -it debian:latest [email protected]:/# ls bin dev home lib64 mnt proc run srv tmp var boot etc lib media opt root sbin sys usr [email protected]:/# ls > newlistfile.txt [email protected]:/# apt-get update && apt-get install -y git Ign:1 http://cdn-fastly.deb.debian.org/debian stretch InRelease Get:2 http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease [91.0 kB] ... Updating certificates in /etc/ssl/certs... 0 added, 0 removed; done. Running hooks in /etc/ca-certificates/update.d... done. [email protected]:/# ls bin dev home lib64 mnt opt root sbin sys usr boot etc lib media newlistfile.txt proc run srv tmp var [email protected]:/# exit
Commit to the Repo
[email protected]:/# exit exit [email protected]:~$ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c8c24ffca1d6 debian:latest "bash" 3 minutes ago Exited (127) 6 seconds ago vibrant_shirley 4ecfe884aecf jamessmith73/debian:latest "cat listfile.txt" 38 minutes ago Exited (0) 38 minutes ago confident_yonath c00aeaaee7ca jamessmith73/debian:latest "ls" 38 minutes ago Exited (0) 38 minutes ago sad_davinci 192bd7f7870f jamessmith73/debian:latest "bash" 39 minutes ago Exited (0) 39 minutes ago blissful_goldstine [email protected]:~$ docker commit c8c24ffca1d6 jamessmith73/debian:2.0 sha256:75e65a41a95ef72812b3da9345bffc096a3c6f98dd6b40c52ecc6d8742a59661 .. [email protected]:~$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE jamessmith73/debian 2.0 75e65a41a95e 30 seconds ago 218MB jamessmith73/debian 1.0 90c1c24a6dd6 15 minutes ago 249MB jamessmith73/debian latest 170489bdc17e About an hour ago 249MB tomcat latest ca9e2fccef98 7 days ago 463MB debian latest be2868bebaba 3 weeks ago 101MB busybox latest 59788edf1f3e 5 weeks ago 1.15MB hello-world latest 4ab4c602aa5e 8 weeks ago 1.84kB [email protected]:~$