Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 764 Bytes

WORKDIR-instruction.md

File metadata and controls

34 lines (25 loc) · 764 Bytes
title slug weight
Dockerfile WORKDIR
Dockerfile-WORKDIR
11

The WORKDIR command is used to define the working directory of a Docker container at any given time. The command is specified in the Dockerfile.

Any RUN, CMD, ADD, COPY, or ENTRYPOINT command will be executed in the specified working directory.

WORKDIR instruction Dockerfile for Docker Quick Start

FROM ubuntu
WORKDIR /var/www/html
RUN apt-get update && apt-get install -y nginx
COPY index.html .
ENTRYPOINT ["nginx", "-g", "daemon off;"]

build dockerfile

docker build -t sangam14/workdir-dockerfile  -f dockerfile.workdir .

run docker container

docker run -p 80:80 sangam14/workdir-dockerfile 

output