我制作了一个docker-composer.yml,因为它更干净。
通过以下命令:
docker run -d -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro -e POSTGRES_USER=rundeck -e POSTGRES_PASSWORD=rundeck --name rundeck_db postgres:9.4.5
docker run --rm -ti -p 192.168.59.103:4440:4440 --link rundeck_db:db --name rundeck 3a34fdafc98a
要:
rundeck_db:
image: postgres:9.4.5
environment:
POSTGRES_USER: rundeck
POSTGRES_PASSWORD: rundeck
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
ports:
- "5432:5432"
rundeck:
build: .
ports:
- "192.168.59.103:4440:4440"
links:
- rundeck_db:db
Dockerfile是
FROM mbopm/ubuntu-oracle-java:2.0
# install rundeck
RUN wget -O /opt/rundeck.deb http://dl.bintray.com/rundeck/rundeck-deb/rundeck-2.6.1-1-GA.deb && \
dpkg -i /opt/rundeck.deb && \
rm -rf /opt/rundeck.deb /var/lib/apt/lists/* /tmp/* /var/tmp/*
# change base configuration
RUN mkdir /etc/service/rundeck && \
mkdir /var/lib/rundeck/.ssh && \
chown -R rundeck:rundeck /var/lib/rundeck
# add init and startup scripts
ADD assets/run/rundeck.sh /etc/service/rundeck/run
ADD assets/startup/* /etc/my_init.d/
# http, https
EXPOSE 4440
# project files
# configs
# ssh-keys
# logs
VOLUME [ "/var/rundeck", "/etc/rundeck", "/var/lib/rundeck/.ssh", "/var/log/rundeck" ]
突然间它无法运作。 (Postgres有效,但Rundeck没有。)
另外docker ps
说
COMMAND
部分应为/sbin/my_init
而不是/bin/sh -c ./run.sh
有什么想法吗?
答案 0 :(得分:1)
添加
CMD [ "/sbin/my_init" ]
在dockerfile末尾的,以便更改COMMAND
部分
答案 1 :(得分:1)
您还可以向docker-compose.yml文件添加命令
rundeck:
build: .
command: /sbin/my_init
ports:
- "192.168.59.103:4440:4440"
links:
- rundeck_db:db