You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 23, 2024. It is now read-only.
Simple script for use as entrypoint to a container
2
+
3
+
Simple script for use as entrypoint to a container.
4
+
5
+
Attempts to intelligently decide if a command is an argument to an application or calling as system
6
+
command. In other words, it is intended to allow all the following use cases:
7
+
8
+
```
9
+
$ docker run --rm foo --version
10
+
foo 0.8
11
+
12
+
$ docker run --rm foo echo boo
13
+
boo
14
+
15
+
$ docker run -it foo sh
16
+
/ #
17
+
/ # exit
18
+
```
19
+
20
+
To use the script, set it as the ENTRYPOINT in a Dockerfile or equivalent, making sure it is
21
+
executable. Also set the environment variable `BASE_COMMAND` appropriately. For example:
22
+
23
+
```
24
+
$ docker run --rm -e BASE_COMMAND="uname" my_image -a
25
+
Linux f3c6b322e73a 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 Linux
26
+
```
27
+
28
+
We've used `-e` for the purposes of this demo, but the variable should be set in the Dockerfile or
29
+
by editing the script.
30
+
31
+
This script is based on the [NodeJS entrypoint script](https://github.com/nodejs/docker-node/blob/e75fa5270326ffaff8fee03153f3bf16860084d4/19/bullseye-slim/docker-entrypoint.sh).
0 commit comments