Cannot set startup script when saving image - very confused
I have a running container, and I wish to save it as an image, specifying a startup script (bash script) when it is launched. Inside the container, before saving to image, I have created a file: /home/data/bin/run.sh The first line in /home/data/bin/run.sh is: #!/bin/bash *I save the image with this command:* *$podman commit --change "CMD=/home/data/bin/run.sh" <container_id> <img_name>* Then I try to run the image, instantiating a container, and I get an error: */bin/sh: /bin/sh: cannot execute binary file* I don't understand why it is using */bin/sh*. At the very top of my *run.sh I have: #!/bin/bash* --- I tried something slightly different, saving the image using the following command, and I get the same error message: *$podman commit --change "CMD=/bin/bash /home/data/bin/run.sh" $ID $NAME* Any ideas would be greatly appreciated, thank you.
On 1/9/20 4:17 PM, Dev Linux wrote:
I have a running container, and I wish to save it as an image, specifying a startup script (bash script) when it is launched.
Inside the container, before saving to image, I have created a file: /home/data/bin/run.sh
The first line in /home/data/bin/run.sh is: #!/bin/bash
*I save the image with this command:*
*$podman commit --change "CMD=/home/data/bin/run.sh" <container_id> <img_name>*
Then I try to run the image, instantiating a container, and I get an error:
*/bin/sh: /bin/sh: cannot execute binary file*
I don't understand why it is using */bin/sh*. At the very top of my *run.sh I have: #!/bin/bash*
--- I tried something slightly different, saving the image using the following command, and I get the same error message:
*$podman commit --change "CMD=/bin/bash /home/data/bin/run.sh" $ID $NAME*
Any ideas would be greatly appreciated, thank you.
_______________________________________________ Podman mailing list -- podman@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
I think the entrypoint is the issue. You could try setting this as the entrypoint rather then the command.
participants (2)
-
Daniel Walsh -
Dev Linux