1
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 5 years have passed since last update.

dockerfile

Last updated at Posted at 2019-03-27

vi Dockerfile

Dockerfile
# ベースとなるイメージを指定する
FROM ruby:2.5

# コンテナ上のワーキングディレクトリを指定する
WORKDIR /usr/src/

RUN useradd -m batch
# ディレクトリやファイルをコピーする
# 左側がホストのディレクトリ、右側がコンテナ上のディレクトリ
COPY ./sample.rb /usr/src/sample.rb
USER batch
COPY --chown=batch:batch ./test /usr/src/test

# "docker build"時に実行される処理
RUN echo "building..."

# "docker run"実行時に実行される処理
#CMD ruby sample.rb
hostOS
TakahashinoMacBook-Air:ReactSample-master $ docker build -t sample-image .

TakahashinoMacBook-Air:ReactSample-master $ docker run -it sample-image "/bin/bash"
docker
batch@ab0a0fe33254:/usr/src$ ls -al
total 16
drwxr-xr-x 1 root  root  4096 Mar 27 12:49 .
drwxr-xr-x 1 root  root  4096 Mar 26 12:00 ..
-rw-r--r-- 1 root  root    13 Mar 27 12:43 sample.rb
drwxr-xr-x 2 batch batch 4096 Mar 27 12:49 test
1
0
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
1
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?