See https://github.com/mgdm/htmlq
# define container name
dc_name=htmlq
# clean up namespace
docker container rename ${dc_name} delete.zfoo &&
{ { docker container stop delete.zfoo ; docker container rm delete.zfoo ; } & }
sleep 1
# run instance as service
docker container run -d \
-v /tmp/${dc_name}:/tmp/${dc_name} \
--name ${dc_name} \
ubuntu:22.04 sleep inf
# update instance
docker container exec -i ${dc_name} /bin/bash << 'eof'
DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y --no-install-recommends \
bsdextrautils \
curl \
jq \
less \
tree \
vim \
;
apt-get install -y \
cargo \
;
cargo install --root /usr/local/ htmlq
eof
# create image from container
docker container commit ${dc_name} ${dc_name}
# connect into instance
docker container exec -it -w /tmp/${dc_name} ${dc_name} /bin/bash
This would definitely be better as a Dockerfile with multi-stage builds.