2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

モダンなLinuxコマンド(Rust製)を Docker上で試す

Last updated at Posted at 2020-03-23

ls よりも exa を使おう!モダンな Linux コマンド達を紹介」の記事を読んで、他にも色々コマンドあるんじゃないかと思って片っ端からインストールしてみました。
※当記事はdockerがインストールされている前提です。また、Windows10環境で動作確認しています。

docker-compose.yml

version: '2'
services:
  modern_linux:
    build: .
    container_name: modern_linux
    volumes:
      - ./home:/home
    tty: true

Dockerfile

From ubuntu:19.10

RUN apt-get update && \
    apt-get install -y software-properties-common && \
    add-apt-repository ppa:dawidd0811/neofetch
RUN apt-get update &&\
    apt install -y curl \
    gcc \
    git \
    neofetch \
    bat \
    fd-find \
    ripgrep
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
RUN $HOME/.cargo/bin/cargo install exa \
    hexyl \
    procs \
    tokei \
    dutree \
    lsd

RUN echo $'\n\
alias cargo="$HOME/.cargo/bin/cargo"\n\
alias exa="$HOME/.cargo/bin/exa"\n\
alias hexyl="$HOME/.cargo/bin/hexyl"\n\
alias procs="$HOME/.cargo/bin/procs"\n\
alias tokei="$HOME/.cargo/bin/tokei"\n\
alias dutree="$HOME/.cargo/bin/dutree"\n\
alias lsd="$HOME/.cargo/bin/lsd"\n\
' >> /root/.bashrc

コマンドを実行する

docker-compose up -d
docker-compose exec modern_linux /bin/bash
# コンテナ内部に入るので、インストールされたコマンドを試してみる。
# 終わったら、exit
docker-compose down

まとめ

Rust製のコマンドはカラフルなものが多くていいですね!
あと何と言ってもちょっと試してみたいときにごにょごにょインストールして、コマンド実行して、終わったら消せるDockerって素晴らしいね。。

参考url

2
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?