facebook twitter hatena line email

「仮想サーバ/docker/Dockerfile」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(Dockerfileを使ってdocker imageを作る)
(Dockerfileを使ってdocker imageを作る)
 
行1: 行1:
 
==Dockerfileを使ってdocker imageを作る==
 
==Dockerfileを使ってdocker imageを作る==
 
  $ vi Dockerfile
 
  $ vi Dockerfile
 +
 
  FROM centos:centos7
 
  FROM centos:centos7
 
  ENV PATH $PATH:/usr/bin
 
  ENV PATH $PATH:/usr/bin
 
  RUN yum -y update
 
  RUN yum -y update
 
  RUN yum -y install httpd
 
  RUN yum -y install httpd
 +
 
  $ docker build -t name1:tag1 .
 
  $ docker build -t name1:tag1 .
 
  $ docker images
 
  $ docker images

2021年1月28日 (木) 21:34時点における最新版

Dockerfileを使ってdocker imageを作る

$ vi Dockerfile
FROM centos:centos7
ENV PATH $PATH:/usr/bin
RUN yum -y update
RUN yum -y install httpd
$ docker build -t name1:tag1 .
$ docker images
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
centos                centos7             a8493f5f50ff        2 weeks ago         192 MB
name1                tag1                 a8493f5f50ff        2 weeks ago         192 MB