I'm trying to add a private key docker-upload
to a docker container:
FROM centos:7
RUN yum -y -q install openssh-clients && \
yum clean all && \
rm -rf /var/cache/yum
RUN \
mkdir -p ~/.ssh && \
touch ~/.ssh/known_hosts && \
ssh-keyscan -p 2022 -t rsa hostname > ~/.ssh/known_hosts
COPY docker-upload ~/.ssh/
RUN ls -all ~/.ssh
When building with
docker build --no-cache -t privateregistry.com/build-containers:upload .
I get that the ~/.ssh directory is empty:
Step 5/7 : COPY docker-nerds-upload ~/.ssh/
---> 2bafa09dd03c
Step 6/7 : RUN ls -all ~/.ssh
---> Running in 1c74fc1d0e14
total 8
drwxr-xr-x 2 root root 4096 Apr 18 14:19 .
dr-xr-x--- 3 root root 4096 Apr 18 14:19 ..
-rw-r--r-- 1 root root 0 Apr 18 14:19 known_hosts
Why doesn't COPY docker-upload ~/.ssh/
copy the file docker-upload
into the ~/.ssh
directory in the docker container?