I created a docker container, but could not start it on the port displayed by the docker ( http: // localhost: 3000 ). Below is information about the docker configurations that I use in my application.
Version for dockers: 17.05.0-ce
Os: ubuntu 16.04
My dockerfile:
FROM node:boron
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN npm install -g bower
RUN npm install -g grunt-cli
RUN npm install
RUN bower install --allow-root
EXPOSE 3000
CMD ["grunt", "serve"]
Creating a docker container:
docker build -t viki76/ng-app .
Container Launch:
docker run -p 3000:3000 -d viki76/ng-app
docker ps:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
21541171d884 viki/ng-app "grunt serve" 10 min ago Up 0.0.0.0:3000->3000/tcp
EDIT:
Updated Dockerfile Configuration
EXPOSE 9000
$ docker run -p 9000: 9000 viki76 / ng-app
Running "serve" task
Running "clean:server" (clean) task
>> 1 path cleaned.
Running "wiredep:app" (wiredep) task
Running "wiredep:test" (wiredep) task
Running "concurrent:server" (concurrent) task
Running "copy:styles" (copy) task
Copied 2 files
Done, without errors.
Execution Time (2017-05-17 13:00:13 UTC-0)
loading tasks 189ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 88%
loading grunt-contrib-copy 11ms ▇▇ 5%
copy:styles 16ms ▇▇▇ 7%
Total 216ms
Running "postcss:server" (postcss) task
>> 2 processed stylesheets created.
Running "connect:livereload" (connect) task
Started connect web server on http://localhost:9000
Running "watch" task
Waiting...
From Gruntfile.js
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: '0.0.0.0',
livereload: 35729
},
Please help me fix this. Thanks
source
share