07L. USER
Less than 1 minute
07L. USER ๊ด๋ จ

๋ชฉ์ฐจ
์ธ์ ๋ ์ต์ Docker
USER๋ ๋ช
๋ น์ ์คํํ ์ฌ์ฉ์ ๊ณ์ ์ ์ค์ ํฉ๋๋ค. RUN, CMD, ENTRYPOINT์ ์ ์ฉ๋ฉ๋๋ค.
.
Dockerfile
USER nobody
USER <๊ณ์ ์ฌ์ฉ์๋ช
> ํ์์
๋๋ค.
USER ๋ค์ ์ค๋ ๋ชจ๋ RUN, CMD, ENTRYPOINT์ ์ ์ฉ๋๋ฉฐ, ์ค๊ฐ์ ๋ค๋ฅธ ์ฌ์ฉ์๋ฅผ ์ค์ ํ์ฌ ์ฌ์ฉ์๋ฅผ ๋ฐ๊ฟ ์ ์์ต๋๋ค.
.
Dockerfile
USER nobody
RUN touch /tmp/hello.txt
USER root
RUN touch /hello.txt
ENTRYPOINT /hello-entrypoint.sh
์ฒ์์๋ nobody ๊ณ์ ์ผ๋ก /tmp/hello.txt ํ์ผ์ ์์ฑํฉ๋๋ค. ๊ทธ ๋ค์๋ถํฐ๋ root ๊ณ์ ์ผ๋ก /hello.txt ํ์ผ์ ์์ฑํ๊ณ (/์๋ root ๊ณ์ ๋ง ํ์ผ์ ์์ฑํ ์ ์์ผ๋ฏ๋ก), /hello-entrypoint.sh ํ์ผ์ ์คํํฉ๋๋ค.