run the image = create container
docker exec containter_id command
or docker attach container_id
then exec command from the commandline
so, net…
script does
# start the container
id=`docker run -d --rm other parms image_name`
# run the command in the container
docker exec id "command to run and parms"
# copy the container log file out
docker cp id from_container_file to_host_file
# kill the container
docker kill id (--rm will cause it to auto destroy)
docker exec id “executable” --> its working
But when I give changing to a different folder using this command --> its NOT working
For ex: docker exec id “cd ~/Desktop” --> its NOT working
How to resolve this issue???
rpc error: code = 13 desc = invalid header field value “oci runtime error: exec failed: container_linux.go:247: starting container process caused “exec format error”\n”
error is coming everytime when I run any script from the container.
But when I run any executable which is available already in the container, its RUNNING properly.
I did chmod +x test_run.sh before copied to container.
After that ran like…
sudo docker exec $id ./test_run.sh – throws below error.
rpc error: code = 13 desc = invalid header field value “oci runtime error: exec failed: container_linux.go:247: starting container process caused “exec format error”\n”
But the same ./test_run.sh is running properly if I run in a attached container.
Throwing failures only in detached mode.