LoginSignup
2
2

More than 1 year has passed since last update.

Dockerfileの書き方

Last updated at Posted at 2021-08-03

Dockerfileの書き方をよく忘れるのでメモ。

# ベースのイメージを指定
FROM centos:7

# 環境変数を指定
ENV export http_proxy="http://hoge:0000"
ENV export https_proxy="http://hoge:0000"

# コマンドを実行
RUN yum install -y java-1.8.0-openjdk-devel

# ユーザーを作成
ARG UID=1000
RUN useradd -m -u ${UID} test

# ユーザーを切り替える
USER ${UID}

# ファイルをコピー
COPY src/image.png /var/tmp

# ファイルをコピー&解凍(圧縮ファイルの場合)
ADD src/text.gz /var/tmp

# 作業ディレクトリを切り替え
WORKDIR /var/tmp

↓公式のドキュメント
https://docs.docker.jp/engine/reference/builder.html

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