In my previous post, Oracle 12c on Docker, you have seen how to install a docker image for the Oracle 12c database and how to run a container.
In this post, I will review some useful Docker commands, that you can use.
The command docker images shows all the docker images that are present on your host.
The command docker exec -it <containername|containerid> bash can be used to login to a specific container.
The command docker stats can be used to see the cpu and memory usage statistics of the containers.
The command docker stop <containername|containerid> can be used to stop a container
You can start a second container on the same host using the same image. (Please refer to the previous post for the command we used to start the first container). When we are starting a second container, we are just changing the host ports that the listener and EM-Express ports are Exposed to.
The command to use is docker run -p 1522:1521 -p 5501:5500 oracle/database:184.108.40.206-ee
Then you can login using a oracle database client tool, to the database in this second container.
One important point to note is that any changes you make to the databases in the containers (As we have set it up) are lost once you shutdown the container. If you want to persist the changes made to the database, you can use the docker commit command to create a new image that has the changes in it.