0
0

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.

DockerFileからImageを作る

Posted at

DockerFile入門で勉強したこと

DockerFile の基本

基本のインストラクション

  • FROM
    ベースイメージの指定
  • RUN
    任意のコマンドの実行、パッケージのインストールや最新化、作業ディレクトリを作成してることもよくある
  • ENV
    環境変数の設定、文字コードやタイムゾーンを設定する
  • COPY
    ローカルのファイルを DockerImage にコピーする、設定ファイルをコピーするに使う
  • WORKDIR
    RUN で作成した作業ディレクトリを設定する

マルチステージビルド

  • 最終的に必要なイメージだけを作成し、イメージをできる限り小さく保つ
  • 複数環境向けの管理
    • build 時に target ステージを指定することで環境ごとの Image を作成できる

DockerHub

Dockerイメージの共通サービス。公開されている公式イメージのDockerFileを確認すると勉強したことを復習できる

まとめ

DockerFileの作成から環境構築の勉強しようと考えていたが、逆だってことに気づいた。作りたい環境構築を想像しないとDockerを使って構築もできない。
DockerFileを使用してイメージを作ることは術的に難しくないけど、作成する環境の方の解像度を高めないといけない

参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?