Skip to content

Instantly share code, notes, and snippets.

@rwcitek
Last active August 10, 2023 03:23
Show Gist options
  • Select an option

  • Save rwcitek/426fd6467c3dd0243db67194835d6eed to your computer and use it in GitHub Desktop.

Select an option

Save rwcitek/426fd6467c3dd0243db67194835d6eed to your computer and use it in GitHub Desktop.
nushell in Docker

Running nushell in Docker

Discover latest version

elinks --dump https://github.com/nushell/nushell/releases |
grep -m1 -o https:.*x86_64-unknown-linux-gnu.tar.gz |
rev |
cut -d/ -f2 |
rev 

Create container and image

# run daemon instance
docker container run -d --name nushell ubuntu:22.04 sleep inf ; sleep 2

# install nushell in instance
docker container exec -i nushell /bin/bash << 'eof'
  export DEBIAN_FRONTEND=noninteractive
  apt-get update
  apt-get install -y pkg-config libssl-dev jq tree vim curl less elinks
  cd /usr/local/bin/
  elinks --dump https://github.com/nushell/nushell/releases |
    grep -m1 -o https:.*x86_64-unknown-linux-gnu.tar.gz |
    xargs curl -Ls |
    tar -xzf -
  ln -snf ./nu-*-unknown-linux-gnu/nu
  yes | nu >& /dev/null

  # get rid of ASCII art
  sed -i -e '/mode.*rounded/ { s/mode/# mode/ ; s/$/\n    mode: none / } ' \
    /root/.config/nushell/config.nu
eof

# commit to image
docker container commit nushell nushell

# remove instance
docker container stop nushell ; docker container rm nushell

# run interactive nushell
docker container run --rm -it nushell nu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment