Quantcast
Viewing all articles
Browse latest Browse all 23

Answer by Kris Rivera for How to include files outside of Docker's build context?

Using docker-compose, I accomplished this by creating a service that mounts the volumes that I need and committing the image of the container. Then, in the subsequent service, I rely on the previously committed image, which has all of the data stored at mounted locations. You will then have have to copy these files to their ultimate destination, as host mounted directories do not get committed when running a docker commit command

You don't have to use docker-compose to accomplish this, but it makes life a bit easier

# docker-compose.ymlversion: '3'  services:    stage:      image: alpine      volumes:        - /host/machine/path:/tmp/container/path      command: bash -c "cp -r /tmp/container/path /final/container/path"    setup:      image: stage
# setup.sh# Start "stage" servicedocker-compose up stage# Commit changes to an image named "stage"docker commit $(docker-compose ps -q stage) stage# Start setup service off of stage imagedocker-compose up setup

Viewing all articles
Browse latest Browse all 23

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>