我是docker的新手,并尝试转换我的实际网络堆栈。 目前我使用此配置: 清漆 - > nginx - > php-fpm - > MySQL的
我已经转换了php-fpm和nginx,现在尝试清漆。
当我使用命令运行我的图像时,一切都很好但是当我把它放入docker-compose时我的容器无限期地重启。
命令:
name="varnish"
cd $installDirectory/$name
docker build -t $name .
docker rm -f $(docker ps -a | grep $name | cut -d' ' -f1)
docker run -d -P --name $name \
-p 80:80 \
--link nginx:nginx \
-v /home/webstack/varnish/:/etc/varnish/ \
-t $name
我的docker-compose.yml:
php-fpm:
restart: always
build: ./php-fpm
volumes:
- "/home/webstack/www/:/var/www/"
nginx:
restart: always
build: ./nginx
ports:
- "8080:8080"
volumes:
- "/home/webstack/nginx/:/etc/nginx/"
- "/home/webstack/log/:/var/log/nginx/"
- "/home/webstack/www/:/var/www/"
links:
- "php-fpm:php-fpm"
varnish:
restart: always
build: ./varnish
ports:
- "80:80"
volumes:
- "/home/webstack/varnish/:/etc/varnish/"
links:
- "nginx:nginx"
我的docker logs webstack_varnish_1
和docker ps -a
结果显示无效:
688c5aace1b3 webstack_varnish "/bin/bash" 16 seconds ago Restarting (0) 5 seconds ago 0.0.0.0:80->80/tcp
在这里,您可以看到我的Dockerfile
:
FROM debian:jessie
# Update apt sources
RUN apt-get -qq update
RUN apt-get install -y curl apt-transport-https
RUN sh -c "curl https://repo.varnish-cache.org/GPG-key.txt | apt-key add -"
RUN echo "deb https://repo.varnish-cache.org/debian/ jessie varnish-4.1" > /etc/apt/sources.list.d/varnish-cache.list
# Update the package repository
RUN apt-get -qq update
# Install varnish
RUN apt-get install -y varnish
# Expose port 80
EXPOSE 80
我做错了什么?
问候。
答案 0 :(得分:1)
您的清漆Dockerfile似乎缺少实际启动Varnish的ENTRYPOINT
和/或CMD
指令。
答案 1 :(得分:0)