"Dockerfile 여러줄 파일 생성하기"의 두 판 사이의 차이

6번째 줄: 6번째 줄:
<syntaxhighlight lang='console'>
<syntaxhighlight lang='console'>
tester@localhost:~/temp1$ cat Dockerfile
tester@localhost:~/temp1$ cat Dockerfile
FROM debian
FROM alpine
RUN set -x; \
RUN set -x; \
{ \
{ \
19번째 줄: 19번째 줄:
tester@localhost:~/temp1$ docker build -t test1 .
tester@localhost:~/temp1$ docker build -t test1 .
Sending build context to Docker daemon  2.048kB
Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM debian
Step 1/2 : FROM alpine
latest: Pulling from library/debian
latest: Pulling from library/alpine
57df1a1f1ad8: Pull complete
df20fa9351a1: Pull complete
Digest: sha256:439a6bae1ef351ba9308fc9a5e69ff7754c14516f6be8ca26975fb564cb7fb76
Digest: sha256:185518070891758909c9f839cf4ca393ee977ac378609f700f60a771a2dfe321
Status: Downloaded newer image for debian:latest
Status: Downloaded newer image for alpine:latest
  ---> f6dcff9b59af
  ---> a24bb4013296
Step 2/2 : RUN set -x; { echo 'opcache.memory_consumption=128'; echo 'opcache.interned_strings_buffer=8'; echo 'opcache.max_accelerated_files=4000'; echo 'opcache.revalidate_freq=60'; } > /tmp/php.ini && cat /tmp/php.ini
Step 2/2 : RUN set -x; { echo 'opcache.memory_consumption=128'; echo 'opcache.interned_strings_buffer=8'; echo 'opcache.max_accelerated_files=4000'; echo 'opcache.revalidate_freq=60'; } > /tmp/php.ini && cat /tmp/php.ini
  ---> Running in 3d7f6e158ece
  ---> Running in 79e419624a7e
+ echo opcache.memory_consumption=128
+ echo 'opcache.memory_consumption=128'
+ echo opcache.interned_strings_buffer=8
+ echo 'opcache.interned_strings_buffer=8'
+ echo opcache.max_accelerated_files=4000
+ echo 'opcache.max_accelerated_files=4000'
+ echo opcache.revalidate_freq=60
+ echo 'opcache.revalidate_freq=60'
+ cat /tmp/php.ini
+ cat /tmp/php.ini
opcache.memory_consumption=128
opcache.memory_consumption=128
36번째 줄: 36번째 줄:
opcache.max_accelerated_files=4000
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.revalidate_freq=60
Removing intermediate container 3d7f6e158ece
Removing intermediate container 79e419624a7e
  ---> ab3e610f4cd3
  ---> 6399defa315d
Successfully built ab3e610f4cd3
Successfully built 6399defa315d
Successfully tagged test1:latest
Successfully tagged test1:latest
</syntaxhighlight>
</syntaxhighlight>

2020년 10월 8일 (목) 13:31 판

1 개요

How to write commands with multiple lines in Dockerfile
Dockerfile 여러줄 파일 생성하기

2 방법 1: 중괄호

tester@localhost:~/temp1$ cat Dockerfile
FROM alpine
RUN set -x; \
{ \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
} > /tmp/php.ini \
&& cat /tmp/php.ini
tester@localhost:~/temp1$ docker build -t test1 .
Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM alpine
latest: Pulling from library/alpine
df20fa9351a1: Pull complete
Digest: sha256:185518070891758909c9f839cf4ca393ee977ac378609f700f60a771a2dfe321
Status: Downloaded newer image for alpine:latest
 ---> a24bb4013296
Step 2/2 : RUN set -x; { echo 'opcache.memory_consumption=128'; echo 'opcache.interned_strings_buffer=8'; echo 'opcache.max_accelerated_files=4000'; echo 'opcache.revalidate_freq=60'; } > /tmp/php.ini && cat /tmp/php.ini
 ---> Running in 79e419624a7e
+ echo 'opcache.memory_consumption=128'
+ echo 'opcache.interned_strings_buffer=8'
+ echo 'opcache.max_accelerated_files=4000'
+ echo 'opcache.revalidate_freq=60'
+ cat /tmp/php.ini
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
Removing intermediate container 79e419624a7e
 ---> 6399defa315d
Successfully built 6399defa315d
Successfully tagged test1:latest

3 같이 보기

4 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}