我正在尝试使用 docker compose 运行 gocd docker image。我想用一个新的替换现有的 Cruise-config 文件。我正在尝试通过将其复制到 Dockerfile 中来用新文件替换现有的 Cruise-config.xml。我能够构建 docker-compose 而没有任何错误,但是当我运行 docker-compose 文件时,go server 容器启动,但几秒钟后退出,错误代码为 1。
文件:Docker-compose.yml
version: '2'
services:
go-server:
build:
context: go_server
dockerfile: Dockerfile
ports:
- '8153:8153'
- '8154:8154'
volumes:
- ./go_server/server_home/config:/go-working-dir/config
文件:go_server/Dockerfile
FROM gocd/gocd-server:v17.8.0
RUN mkdir -p /go-working-dir/config
RUN chmod 777 -R /go-working-dir/config
COPY ./server_home/config/cruise-config.xml /go-working-dir/config/cruise-config.xml
COPY ./server_home/config/cruise-config.xml /go-working-dir/config/cruise-config.xml2
RUN chown -R go:go /go-working-dir /godata
EXPOSE 8153 8154
我在这里错过了什么吗?容器的日志文件显示没有错误
Logs:
dailybuild@DockerHost:~$ sudo docker logs 5af1aefa0c9d
/docker-entrypoint.sh: Creating directories and symlinks to hold GoCD configuration, data, and logs
$ mkdir -v /godata/artifacts
$ chown go:go /godata/artifacts
$ ln -sv /godata/artifacts /go-working-dir/artifacts
$ chown go:go /go-working-dir/artifacts
$ mkdir -v /godata/config
$ chown go:go /godata/config
$ mkdir -v /godata/db
$ chown go:go /godata/db
$ ln -sv /godata/db /go-working-dir/db
$ chown go:go /go-working-dir/db
created directory: '/godata/artifacts'
'/go-working-dir/artifacts' -> '/godata/artifacts'
created directory: '/godata/config'
created directory: '/godata/db'
'/go-working-dir/db' -> '/godata/db'
created directory: '/godata/logs'
'/go-working-dir/logs' -> '/godata/logs'
created directory: '/godata/plugins'
$ mkdir -v /godata/logs
$ chown go:go /godata/logs
$ ln -sv /godata/logs /go-working-dir/logs
$ chown go:go /go-working-dir/logs
$ mkdir -v /godata/plugins
'/go-working-dir/plugins' -> '/godata/plugins'
created directory: '/godata/addons'
'/go-working-dir/addons' -> '/godata/addons'
$ chown go:go /godata/plugins
$ ln -sv /godata/plugins /go-working-dir/plugins
$ chown go:go /go-working-dir/plugins
$ mkdir -v /godata/addons
$ chown go:go /godata/addons
$ ln -sv /godata/addons /go-working-dir/addons
$ chown go:go /go-working-dir/addons