简体   繁体   中英

Run container with volume and entrypoint from docker command/

I am trying to run a container with volume and customized entry point, and then execute a .sh script inside the volume I shared from the docker command.

I have a folder inside my primary machine on that location: ~/vol , and inside I have a script that I want to execute on the container.

[root@ilcepoc2457 vol]# pwd
/root/vol
[root@ilcepoc2457 vol]# ll
total 8
-rwxrwxrwx.  1 root root   17 Jan 29 17:11 startup.sh
dr-xr-x---. 14 root root 4096 Jan 29 17:11 ..
drwxr-xr-x.  2 root root   24 Jan 29 17:11 .

I am trying to create a container using this command:

docker run -i -t -d --volume /vol:/vol --entrypoint "/startup.sh" mcr.microsoft.com/playwright

And this is the error I get:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/startup.sh": stat /startup.sh: no such file or directory: unknown.

What am I missing here?

The directory you show is /root/vol , but you map /vol .

Your directory is mapped to the /vol directory, but your entrypoint /startup.sh says that it's in the root of the file system. Use /vol/startup.sh instead, like this

docker run -i -t -d --volume /root/vol:/vol --entrypoint "/vol/startup.sh"  mcr.microsoft.com/playwright

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM