Reputation: 141
sorry if the question is basic but would it be possible to build a docker image from another one with a different volume in the new image? My use case is the following:
how can we achieve that? I would like to avoid putting extra folders into the host filesystem
thanks a lot
Upvotes: 2
Views: 1277
Reputation: 63
This approach seems to work best until the Docker development team adds the capability you are looking for.
Dockerfile
FROM percona:5.7.24 as dbdata
MAINTAINER [email protected]
FROM centos:7
USER root
COPY --from=dbdata / /
Do whatever you want . This eliminates the VOLUME issue. Heck maybe I'll write tool to automatically do this :)
Upvotes: 2
Reputation: 4677
You have a few options, without involving the host OS that runs the container.
Make your own Dockerfile, inherit from the library/odoo Docker image using a FROM
instruction, and COPY
files into the /mnt/extra-addons
directory. This still involves your host OS somewhat, but may be acceptable since you wouldn't necessarily be building the Docker image on the same host you were running it.
Make your own Dockerfile, as in (1), but use an entrypoint script to download the contents of /mnt/extra-addons
at runtime. This would increase your container startup time since the download would need to take place before running your service, but no host directories would need be involved.
Personally I would opt for (1) if your build pipeline supports it. That would bake the addons right into the image, so the image itself would be a complete, ready-to-go build artifact.
Upvotes: 0