There is a little trick, if you can call it that, to run a single command inside of an ephemeral docker container.
docker container run --rm -it alpine sh
The above example will run
an interactive shell and allocate a pseudo-tty (-it
) using the alpine
image.
Once it has ran, it will remove the container again (--rm
). This is nice since it prevents creating a slew of dangling containers.
Since alpine linux uses busybox under the hood the command we run, sh
, will be the Almquist shell (/bin/ash).