16
8

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.

Dockerfileで複数行を改行付きでechoする

Last updated at Posted at 2017-07-04

Dockefile内でyumリポジトリ設定のような複数行をechoしてリダイレクトしてファイルを作成する方法です。

次に示すように$付きの文字列としてechoします。 改行は\nと記述します。

RUN echo $'[centos]\n\
name=CentOS-6 - Base\n\
mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os\n\
enabled=0\n\
gpgcheck=1\n\
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6' > /etc/yum.repos.d/CentOS-Base.repo

イメージのOS次第かもしれません。

16
8
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
16
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?