Skip to content

Instantly share code, notes, and snippets.

@rwcitek
Last active June 1, 2023 00:34
Show Gist options
  • Save rwcitek/79343fc36e17a49b534a8bb7b285bd7a to your computer and use it in GitHub Desktop.
Save rwcitek/79343fc36e17a49b534a8bb7b285bd7a to your computer and use it in GitHub Desktop.
Installing and running htmlq within Docker

Installing and running htmlq within Docker

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment