33
19

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 1 year has passed since last update.

Docker 初心者 | RUN と CMD の違い

Last updated at Posted at 2017-09-30
  • RUN - イメージ作成時に実行される
  • CMD - コンテナ実行時に実行される

Dockerfile

Dockerfile
FROM alpine

RUN echo "RUN!"
CMD echo "CMD!"

イメージ作成

$ docker build . -t example_container
(色々な処理)

RUN!

(色々な処理)

コンテナ実行

$ docker run example_container
CMD!

参考

環境

  • Docker version 17.03.1-ce, build c6d412e

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

33
19
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
33
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?