LoginSignup
0
1

More than 5 years have passed since last update.

Makefileでdocker network createする

Last updated at Posted at 2017-03-04

せっかくMakefileでやるなら冪等性も担保したい。ということで書いてみました。
(ここでいう冪等性は、ないなら作る、あるなら何もしない、の意)

docker-network-foo:
        @if docker network inspect foo >/dev/null 2>/dev/null ; then echo network foo exists; else docker network create foo; fi

ポイント

docker network inspect foo と叩くと、存在しなければ非ゼロでexitするので、それを利用する。

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