Reputation: 71
I have created a docker image named ocp-install from the following dockerfile
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
ARG INSTALL_DIR=/root/install-dir
ENV PATH $PATH:$INSTALL_DIR
WORKDIR $INSTALL_DIR
RUN microdnf update && \
microdnf install -y yum findutils && \
mkdir -p $INSTALL_DIR
COPY ocp-install $INSTALL_DIR
ENTRYPOINT ["/bin/bash", "/usr/bin/ocp-install"]
I have run the command docker run -it ocp-install create
for installation.
And now i want to destroy the install using command docker exec -it <containerID> destroy
, however it gives the following error
OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"destroy\": executable file not found in $PATH": unknown
Upvotes: 1
Views: 10988
Reputation: 874
short answer:
exec
runs a new command, destroy is the subcommand of ocp-install
, so you have to specify the whole command:
docker exec -it <containerID> -- /usr/bin/ocp-install destroy
as https://docs.docker.com/engine/reference/builder/#entrypoint describe,
Command line arguments to docker run will be appended after all elements in an exec form ENTRYPOINT
ENTRYPOINT
works for docker run
but not docker exec
as https://docs.docker.com/engine/reference/commandline/exec/ describe,
The docker exec command runs a new command in a running container.
When you are trying the docker exec -it <containerID> destroy
command, docker tried to run the command destroy
instead of appending destroy
args to ocp-install
Upvotes: 1