Я пытаюсь запустить pacman webapp на локальном хосте с балансировкой нагрузки и прокси с nginx.у меня появляется эта ошибка, когда я иду на localhost: 8080 502 bad gateway
другая информация: docker logs dockerpacman_nginx_1
2019/09/19 08:07:40 [error] 8#8: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.27.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://172.27.0.3:3000/", host: "localhost:8080"
172.27.0.1 - - [19/Sep/2019:08:07:40 +0000] "GET / HTTP/1.1" 502 157 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0
sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c160237a9dd8 dockerpacman_nginx "nginx -g 'daemon of…" 4 minutes ago Up 4 minutes 80/tcp, 0.0.0.0:8080->8080/tcp dockerpacman_nginx_1
284e3196c91d dockerpacman_pacman "nginx -g 'daemon of…" 4 minutes ago Up 4 minutes 80/tcp, 3000/tcp dockerpacman_pacman_1
d92496f05513 redis "docker-entrypoint.s…" 4 minutes ago Up 4 minutes 0.0.0.0:32787->6379/tcp dockerpacman_redis_1 ```
docker-compose.yml
version: '3'
services:
nginx:
build: ./nginx/
links: ['pacman:pacman']
ports: ['8080:8080']
pacman:
build: .
links: [redis]
redis:
image: redis
ports: ['6379']
Dockerfile для pacman:
#Start with current nginx
FROM nginx:latest
#Update package manager and install git
RUN apt-get update && apt-get install -y \
git\
curl\
vim\
systemd\
systemd-container\
net-tools\
procps\
sudo\
iproute2\
kmod\
iptables
#Clean the html root dir
RUN rm -R /usr/share/nginx/html/
#Copy pacman app from docker
COPY pacman /usr/share/nginx/html/
#Modify files for web serving
RUN chmod -R 755 /usr/share/nginx/html/*
RUN chown -R www-data /usr/share/nginx/html/*
#octoshield in another script
COPY script/octoshield.sh /home/docker/script/
COPY script/config.yml home/docker/script/
RUN chmod 744 /home/docker/script/octoshield.sh
EXPOSE 3000
nginx.conf
worker_processes 4;
events { worker_connections 1024; }
http {
upstream mysite {
least_conn;
server pacman:3000;
}
server {
listen 8080;
server_name localhost;
location / {
proxy_pass http://mysite;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
}
, пожалуйста, помогите мне.Я полагаю, что проблема в том, что я не запускаю приложение js в Docker, но когда я работаю только с Dockerfile
#sudo docker build . -t pacman
#sudo docker run --privileged=true --name=pacman -d -p 8080:80 pacman
, который работает
, но не с Docker-compose sudo docker-compose up -d --build