2017-09-08 8 views
0

도커 멍청한 놈 사이의 엔트리 포인트/CMD의 순서의 차이 ...Dockerfile 및 고정 표시기 실행 여기

내가 구축하고 Dockerfile에서 IBM 데이터 파워 컨테이너를 실행하려고하지만 보이지 않는 이해 docker run을 실행하고 터미널에서 동일한 매개 변수를 전달할 때와 동일하게 작동합니다.

이 작동 (docker run)

docker run -it \ 
    -v $PWD/config:/drouter/config \ 
    -e DATAPOWER_ACCEPT_LICENSE=true \ 
    -e DATAPOWER_INTERACTIVE=true \ 
    -e DATAPOWER_WORKER_THREADS=4 \ 
    -p 9090:9090 \ 
    --name mydatapower \ 
    ibmcom/datapower 

...는 ./config 폴더를 마운트하고 사용자 정의 구성 컨테이너에서 실행되는 데이터 파워에 의해 포착되는되는 중요한 부분.

이하지 않습니다 (Dockerfile)

Dockerfile :

FROM ibmcom/datapower 

ENV DATAPOWER_ACCEPT_LICENSE=true 
ENV DATAPOWER_INTERACTIVE=true 
ENV DATAPOWER_WORKER_THREADS=4 

EXPOSE 9090 

COPY config/auto-startup.cfg /drouter/config/auto-startup.cfg 

빌드 :

docker build -t local/datapower . 

실행 :

docker run -it \ 
    -p 9090:9090 \ 
    --name mydatapower local/datapower 

문제는 DataPower가 auto-startup.cfg 파일을 선택하지 않기 때문에 추가 구성 옵션이 사용되지 않는다는 것입니다. 파일 이름을 잘못 입력하면 오류가 발생하기 때문에 원본 파일 경로가 올바른 것으로 알고 있습니다.

구성 파일을 사용하기 전에 상속 된 ENTRYPOINT 또는 CMD를 실행 중일 수 있다는 이론이 있습니다. 나는 이것을 테스트하거나 증명할 방법을 모른다. 상속 된 이미지가 오픈 소스가 아니기 때문에 ENTRYPOINT 또는 CMD가 무엇인지 알 수 없으며이를 찾는 방법을 찾을 수 없습니다.

가능성이 있습니까?

UPDATE :

auto-startup.cfg의 내용은 다음과 같습니다

top; co 

ssh 

web-mgmt 
    admin enabled 
    port 9090 
exit 

단순히 데이터 파워 웹 GUI를 할 수 있습니다 그것은.

와 명령 줄에서 실행 출력 :

docker run -it -v $PWD/config:/drouter/config -v $PWD/local:/drouter/local -e DATAPOWER_ACCEPT_LICENSE=true -e DATAPOWER_INTERACTIVE=true -e DATAPOWER_WORKER_THREADS=4 -p 9091:9090 --name myconfigureddatapower ibmcom/datapower` 

가 ...이 포함

20170908T121729.015Z [0x8100006e][system][notice] : Executing startup configuration. 
20170908T121729.970Z [0x00350014][mgmt][notice] web-mgmt(WebGUI-Settings): tid(303): Operational state up 

...하지만 Dockerfile으로하지 않습니다. 그래서 설정 파일이 너무 늦게 복사 될 수 있다고 생각합니다.

Dockerfile의 끝에 CMD ["/bin/drouter"]을 추가하려고 시도했습니다.

+0

기존 이미지에 대한'ENTRYPOINT'과'CMD'을 찾기 위해 고정 표시기 이미지가 을'검사'사용할 수 있습니다 . – larsks

+0

감사 @larsks : – hofnarwillie

답변

1

Dockerfile을 테스트했으며 정상적으로 작동하는 것 같습니다. 내 auto-startup.cfg 파일이 적절한 위치에 복사되고 컨테이너를 실행하면 파일을 읽습니다.

나는이 출력을 얻을 :

[[email protected] tmp]# docker run -ti -p 9090:9090 test 
20170908T123728.818Z [0x8040006b][system][notice] logging target(default-log): Logging started. 
20170908T123729.067Z [0x804000fe][system][notice] : Container instance UUID: 36bcca0e-6139-4694-91b0-2b7b66c3a498, Cores: 4, vCPUs: 4, CPU model: Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz, Memory: 16049.1MB, Platform: docker, OS: dpos, Edition: developers-limited, Up time: 0 minutes 
20170908T123729.071Z [0x8040001c][system][notice] : DataPower IDG is on-line. 
20170908T123729.071Z [0x8100006f][system][notice] : Executing default startup configuration. 
20170908T123729.416Z [0x8100006d][system][notice] : Executing system configuration. 
20170908T123729.417Z [0x8100006b][mgmt][notice] domain(default): tid(8143): Domain operational state is up. 
708f98be1390 
Unauthorized access prohibited. 
20170908T123731.239Z [0x806000dd][system][notice] cert-monitor(Certificate Monitor): tid(399): Enabling Certificate Monitor to scan once every 1 days for soon to expire certificates 
20170908T123731.552Z [0x8100006e][system][notice] : Executing startup configuration. 
20170908T123732.436Z [0x8100003b][mgmt][notice] domain(default): Domain configured successfully. 
20170908T123732.449Z [0x00350014][mgmt][notice] web-mgmt(WebGUI-Settings): tid(303): Operational state up 
login: 

이 파일은 당신이 컨테이너를 입력 한 다음 /drouter/config/의 내용을 확인 docker run -ti local/datapower sh을 실행할 수있는 컨테이너에 복사 된 것을 확인합니다.

귀하의 기본 이미지의 명령은 다음과 같습니다 CMD ["/bin/drouter"] 당신이 docker history ibmcom/datapower를 실행 확인할 수 있습니다.

UPDATE :

컨테이너의 drouter 사용자가 auto-startup.cfg 파일을 읽을 수 있어야합니다.

  • 가 적절한 권한 (chmod 644 config/autostart.cfg)와 해당 지역의 auto-startup.cfg를 설정 : 당신은 두 가지 옵션이 있습니다.
  • 정도 drouter 파일을 읽을 수있는 Dockerfile에이 라인을 추가 :

    USER root 
    RUN chown drouter /drouter/config/auto-startup.cfg 
    USER drouter 
    
+0

은 대단히 감사합니다! 이미 도움이되었지만 여전히 효과가 없습니다. 로그 출력에 대한 업데이트 사항을 확인하십시오. – hofnarwillie

+0

@hofnarwillie 나는 이미지를 실행했을 때 얻을 로그와 답을 갱신. –

+0

이상 하네. 나는'web-mgmt (WebGUI-Settings) : tid (303) : Operational state up'을 얻지 못했다. '$ 고양이 drouter/설정/자동 startup.cfg'> '고양이 : 열 수 없습니다 'drouter/설정/자동 startup.cfg'내가 할 용기 내부의 쉘 실행하는 경우 또한 권한 denied' – hofnarwillie