LoginSignup
0
0

More than 3 years have passed since last update.

UbuntuのOfficial Docker image内でlsb_release -cs相当のことを実現する

Posted at

Ubuntuのdocker iamgeにはlsb_releaseが入っていないため、Dockerfile中にlsb_release相当のことをするにはちょっと工夫が必要になります。lsb_coreをインストールすれば使えるようにはなりますが、わざわざインストールするのもためらうときに使えるtipsです。

例えば、lsb_release -csはOSのコードネームを取得するコマンドですが、これと同様のことをしたければ、下記の様に書くことができます。。要はlsb_releaseが参照している情報は/etc/lsb-releaseに格納されているので、そこから必要な文字列を取り出せばいいわけです。

RUN export ubuntu_codename=$(cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d = -f 2)
0
0
0

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
0
0