Base Oracle DB images container-registry.oracle.com/database/enterprise:12.2.0.1 and container-registry.oracle.com/database/enterprise:12.2.0.1-slim have the following volume mount declared:
VOLUME ["/ORCL"]
Because there is no way to remove or unset a volume when extending an image, this basically prevents me from being able to create an image pre-loaded with a test or dev database.
Even if you unpack, setup, configure, and load a database, it just disappears after that Dockerfile line ends.
There are no benefits to declaring a volume line in a dockerfile. Even if you do, the client still has to declare a volume anyway to make any use of it (for example, by declaring it in a run statement or in their docker-compose.yaml file). And removing this line will have no effect, because the client can still create a volume anytime they want to be putting it in their run statement or docker-compose file.
Can you please remove the volume mount declaration from the base image?
@brunoborges @gvenzl just wondering if there is any update on this?
I'd say you should simply get the original Dockerfile, and edit it to your own needs. Most users do want VOLUME.
@brunoborges: There is no original Dockerfile for the Database images stored on the Oracle Container Registry or Docker Store. Unlike every other product, they do not use the same Dockerfiles hosted here on GitHub.
@veqryn: The only option if you don't want the preconfigured VOLUME is to stop using the prebuilt images and to use the GitHub Dockerfile to build your own image for Database instead.
@Djelibeybi sorry, when I said "original Dockerfile" I simply meant the Dockerfile in this repo, and to build from scratch... :P
So, I prefer to use the containers in the Oracle Container Registry because they are already made and I assume supported by Oracle.
Why do we have two different ways of creating the same container, and why isn't the Dockerfile for the ones in the Oracle Container Registry published? (ie: container-registry.oracle.com/database/enterprise:12.2.0.1)
Oracle Database is certified to run inside a Docker container regardless of how that container was created.
Having said that, the Dockerfile in this repo was created by Oracle and the image hosted on Oracle Container Registry and Docker Store are created by Oracle. So both are equally acceptable in terms of provenance.
Finally, while there are reasons behind why only the Database image is different, I'm afraid I can't discuss them here on GitHub.
So, if we aren't able to get into the why, can we at least address the what? ie: what is the actual difference between an Oracle Enterprise Database container image created through the Dockerfile in this repo, and the same version of it found on in the image repo container-registry.oracle.com/database/enterprise?
Like, how are the Dockerfiles different?
They are completely different. There is no way to even compare them. The image on Container Registry and Docker Store bares almost zero resemblance to the once here on GitHub. I've never actually seen the Dockerfile that was used to build the image on OCR/Store, in fact.
@gvenzl may be able to address the differences. But sincerely, you shouldn't worry about the difference. If you don't like the features of the pre-built images, we encourage you to build your own, and support will still be provided if needed.
After a while of discussions, etc. I have followed up on this on the Docker Forum: https://forums.docker.com/t/why-use-the-volume-instruction/55420
Let's see what we get back and @veqryn, please feel free to chime in over there as well!
I was about to write up another issue, but luckily did a search instead.
I see a couple reasons why the VOLUME instruction should be removed.
VOLUME instruction in inheriting dockerfiles. See: https://github.com/moby/moby/issues/3465docker run), it doesn't even provide that much data-safety for someone who is new to docker, as the container will start with a new anonymous volume when docker run is executed again. (+ not being able to find the correct volume, as said before)docker cp files out from a stopped container.I guess the Dockerfile volume instruction is a left-over from a time when docker handed volumes differently and didn't have named volumes yet?
So i'd like to show support towards removing the VOLUME instruction from DB dockerfiles here.
I would like it if the image can be built without any volume.
So it is possible to build an image that contains a completely preinstalled instance. Especially for testing it would be nice not to wait until the instance has been created.
I think it would be better if the VOLUME were optional at least for the Dockerfiles. The VOLUME could be added at a separate stage at the end of the Dockerfile:
https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage
This unremovable VOLUME also hurts me while trying to create a database instance during docker build.
There's a simple workaround possible for the VOLUME-issue:
The Dockerfile and two wrapper-files for docker build and run I attach here as zip
files.zip
:
@simpss has clearly listed the problems related to having a VOLUME in the Dockerfile and there does not seem to be any reason to keep it.
@brunoborges you said
I'd say you should simply get the original Dockerfile, and edit it to your own needs. Most users do want VOLUME.
Could you please clarify why most users would want or need VOLUME in the Dockerfile?
@brunoborges has nothing to do with this repo any more. It's up to @gvenzl now.
The VOLUME and EXPOSE instructions got removed.
Most helpful comment
I was about to write up another issue, but luckily did a search instead.
I see a couple reasons why the VOLUME instruction should be removed.
VOLUMEinstruction in inheriting dockerfiles. See: https://github.com/moby/moby/issues/3465docker run), it doesn't even provide that much data-safety for someone who is new to docker, as the container will start with a new anonymous volume whendocker runis executed again. (+ not being able to find the correct volume, as said before)docker cpfiles out from a stopped container.I guess the Dockerfile volume instruction is a left-over from a time when docker handed volumes differently and didn't have named volumes yet?
So i'd like to show support towards removing the
VOLUMEinstruction from DB dockerfiles here.