Browserify在Docker容器中不起作用

我正在设置我的项目,并将browserify设置为使用我的前端资产并刷新浏览器。

对于后端我使用django,所以,我在同一时间作品之间作了代理: gulfile.js

// Start a server with BrowserSync to preview the site in function server(done) { browser.init({ // server: PATHS.dist, //port: PORT proxy: 'localhost:8000', notify: false }); done(); } 

但是当我和composer php一起创作这个作品的时候,这并不起作用,当我起来composer php的时候,根本没有告诉我什么:

 sass_1 | [BS] Proxying: http://localhost:8000 sass_1 | [BS] Access URLs: sass_1 | ----------------------------------- sass_1 | Local: http://localhost:3000 sass_1 | External: http://172.18.0.7:3000 sass_1 | ----------------------------------- sass_1 | UI: http://localhost:3001 sass_1 | UI External: http://172.18.0.7:3001 sass_1 | ----------------------------------- sass_1 | [BS] Couldn't open browser (if you are using BrowserSync in a headless environment, you might want to set the open option to false) 

它工作正常,当我起床以来,因为我的电脑,没有使用docker,但在docker,它可以打开我的浏览器,我不能进入3000端口。

我得到了与django-debug-toolbar相同的问题,但我解决了把内部IPS从dockerconfiguration。

我试图更改ips gateway gulpfile内的端口(解决之前的错误),但不起作用。

我的docker-composer文件是:

 version: '2' services: web: build: . image: uzman command: python manage.py runserver 0.0.0.0:8000 ports: - "3000:3000" - "8000:8000" volumes: - .:/code depends_on: - npm - bower - sass - migration - db - redis - elasticsearch db: image: postgres:latest volumes: - .:/tmp/data/ npm: image: uzman command: npm install volumes: - ./uzman/static:/code/uzman/static working_dir: /code/uzman/static bower: image: uzman command: bower install --allow-root volumes: - ./uzman/static:/code/uzman/static working_dir: /code/uzman/static elasticsearch: image: elasticsearch:latest command: elasticsearch -Enetwork.host=0.0.0.0 ports: - "9200:9200" - "9300:9300" redis: image: redis:latest sass: image: uzman command: npm start volumes: - ./uzman/static:/code/uzman/static working_dir: /code/uzman/static migration: image: uzman command: python manage.py migrate --noinput volumes: - .:/code 

谁能帮我这个?

问题是, browserify不能在同一时间运行,因为这些原因是不可能获得访问它。

因此揭露端口为browserify:

 ports: - "3000:3000" - "3001:3001" - "8000:8000" 

并执行npmdocker exec -it uzman_web_1 bash -c "cd /code/uzman/static; exec npm start"

就是这样