Last active
November 2, 2016 16:39
-
-
Save ashb/3215423fa25899bf01b5eafc028a9f6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine | |
RUN ls /etc/profile.d /usr/local/bin /usr | |
COPY resources/etc/ /etc | |
COPY resources/usr/ /usr | |
RUN ls /etc/profile.d/ /usr/local/bin /usr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir -p resources/etc/profile.d/ resources/usr/local/bin | |
touch resources/etc/profile.d/my_vars.sh resources/usr/local/bin/my-script | |
docker build -t test . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Docker behaves really oddly (or at least not how I wanted) when copying a directory under the src of
COPY
(ADD
behaves the same).This is slightly hard to describe, but essentially when docker is copying in a nested directory it replaces it, rather than copying the files in one-by-one. This means you can't easily copy in many files and merge them with ones existing in the layer for many directories at once.
The output of the first RUN shows some existing files in /etc/profile.d:
Step 5 : RUN ls /etc/profile.d/ /usr/local/bin /usr
---> Running in dca4ed2024f7
/etc/profile.d/:
color_prompt
my_vars.sh
/usr:
bin
lib
local
sbin
share
/usr/local/bin:
my-script
---> 8bf17bf8dd66