问题描述
我有一个 docker compose 文件来保存我的 cypress 容器:
version: '3'
services:
redis:
image: redis
ports:
- "6379"
# restart: unless-stopped
networks:
main:
aliases:
- redis
postgres:
image: postgres:12
ports:
- "5432:5432"
env_file: ./.env
# restart: unless-stopped
volumes:
- pgdata:/var/lib/postgresql/data
networks:
main:
aliases:
- postgres
#access by going to localhost:16543
#when adding a server to the serve list
#the hostname is postgres
#the username is postgres
#the password is postgres
pgadmin:
image: dpage/pgadmin4
links:
- postgres
depends_on:
- postgres
env_file: ./.env
# restart: unless-stopped
ports:
- "16543:80"
networks:
main:
aliases:
- pgadmin
celery:
build:
context: .
dockerfile: Dockerfile-dev # use docker-dev because production npm installs and npm builds
command: python manage.py celery
env_file: ./.env
# restart: unless-stopped
volumes:
- .:/code
- tmp:/tmp
links:
- redis
depends_on:
- redis
networks:
main:
aliases:
- celery
web:
build:
context: .
dockerfile: Dockerfile-dev
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
- tmp:/tmp
ports:
- "8000:8000"
env_file: ./.env
# restart: unless-stopped
links:
- postgres
- redis
- celery
- pgadmin
depends_on:
- postgres
- redis
- celery
- pgadmin
networks:
main:
aliases:
- web
# Cypress container
cypress:
# the Docker image to use from https://github.com/cypress-io/cypress-docker-images
image: "cypress/included:4.0.2"
depends_on:
- web
environment:
# pass base url to test pointing at the web application
- CYPRESS_BASE_URL=http://web:8000
# share the current folder as volume to avoid copying
working_dir: /e2e
volumes:
- ./:/e2e
networks:
main:
aliases:
- cypress
volumes:
pgdata:
tmp:
networks:
main:
出于某种原因,当我启动我的服务器然后使用 docker-compose up --exit-code-from cypress
启动 cypress 时,我收到以下错误,我似乎无法调试,请注意我的服务器正在运行,并且都在同一网络上主要
Cypress Could not verify that this server is running:
> http://web:8000
We are verifying this server because it has been configured as your `baseUrl`.
Cypress automatically waits until your server is accessible before running tests.
We will try connecting to it 3 more times...
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 4.0.2 │
│ browser: Electron 78 (headless) │
│ Specs: 1 found (login/test.spec.js) │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: login/test.spec.js (1 of 1)
browserslist: caniuse-lite is outdated. Please run the following command: `yarn upgrade`
Login Page
1) Visits Page
0 passing (671ms)
1 failing
1) Login Page Visits Page:
CypressError: cy.visit() Failed trying to load:
http://127.0.0.1:8000/test/
We attempted to make an http request to this URL but the request Failed without a response.
We received this error at the network level:
> Error: connect ECONNREFUSED 127.0.0.1:8000
Common situations why this would fail:
- you don't have internet access
- you forgot to run / boot your web server
- your web server isn't accessible
- you have weird network configuration settings on your computer
The stack trace for this error is:
Error: connect ECONNREFUSED 127.0.0.1:8000
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)