Hallo, I’m new podman user. the question is trivial one, but I have not find solution on google.
All that I find is post on DOCKER COPY, DOCKER CP or
cp from:
- host to container or
- container to host or
- container to other container
…
but I have to do a cp inside container after is runned:
from directory inside the container → to an existing directory inside the same container.
( … and is not a permission error)
my ContainerFile:
FROM fedora:latest
ENV LANG=C.UTF-8
#install some stuff
RUN dnf -y install findutils salt-master salt-api \
&& dnf clean all
#copy my bash start script
COPY entrypoint.sh /entrypoint.sh
#make a backup folder
RUN mkdir /etc/salt.dist
#backup some installathion data
RUN cp -a /etc/salt /etc/salt.dist
EXPOSE 4505/tcp 4506/tcp
#volume to mantein configuration, log, cache
VOLUME /etc/salt \
/var/cache/salt \
/var/log/salt \
/srv
#start bash script when running
CMD ["/bin/bash","/entrypoint.sh"]
my build command: $ podman build -f Containerfile -t fedora/salt-master
the container build execute without error.
my entrypoint.sh file:
#!/bin/bash
set -o errexit
echo "I am root" && id
if [ -n "$( find "/etc/salt/" -maxdepth 0 -empty )" ]; then
if [ -d "/etc/salt.dist/salt" ] && [ -r "/etc/salt.dist/salt" ]; then
cp -a "/etc/salt.dist/salt/*" "/etc/salt/"
#^-- this above is not working
# error: cp: cannot stat '/etc/salt.dist/salt/*': No such file or directory
fi
fi
if [ -d "/etc/salt" ] && [ -r "/etc/salt" ]; then
ls -la "/etc/salt"
fi
if I change
cp -a "/etc/salt.dist/salt/*" "/etc/salt/"
in
cp -a "/etc/salt.dist/salt" "/etc/salt/"
the cp commad run without error but
copy the dir salt on /etc/salt making /etc/salt/salt
and this is not what I want.
the problem have to be in /*
and have to be easy to solve
but I am not be able to find a solution.
can anyone help?
best regards,
Leonardo
P.S.
my run command is this:
podman run -v ./volumes/etc/salt:/etc/salt:rw,z -v ./volumes/srv:/srv:rw,z -v ./volumes/var/cache/salt:/var/cache/salt:rw,z -v ./volumes/var/log/salt:/var/log/salt:rw,z --rm --name pod-master fedora/salt-master