This is my first dockerfile project with docker-compose. In my project I try create a docker-compose file.
node/Dockerfile
FROM centos:latest
MAINTAINER braulio@braulioti.com.br
LABEL Description="Site Brau.io - API NodeJS"
EXPOSE 3000
RUN yum update -y \
&& yum install -y java-1.8.0-openjdk \
&& yum update -y \
&& yum install -y epel-release \
&& yum install -y nodejs \
&& yum install -y psmisc \
&& npm install -g forever \
&& npm install -g typescript
RUN rm -rf /etc/localtime && ln -s /usr/share/zoneinfo/Brazil/East /etc/localtime
RUN mkdir -p /app
VOLUME ["/app"]
docker-compose.yml
version: '3'
services:
node:
build: node
image: docker_node
ports:
- "8082:3000"
container_name: "brau_io_api"
volumes:
- /app/brau_io/api:/app/
command: /bin/bash
This project result in:
Error response from daemon: Container 65cecc8bdc923c3f596dba91fd059b8268fd390737391d4d91afa7d34325bea1 is not running
In docker-compose you should create some services and you can link them. for example:
docker-compose.yml
version: '3'
services:
my_app:
build: .
image: my_app:1.0.0
container_name: my_app_container
command: ... # you can run a bash file or a command
I created a docker-compose with my_app service which it can create my_app image. you can rewrite it with your node container.
I enabled the tty function in my docker-compose.yml file and works like a chaming ( See Reference ).
This is my final docker-compose.yml file:
docker-compose.yml
version: '3'
services:
node:
build: node
image: docker_node
ports:
- "8082:3000"
container_name: "brau_io_api"
volumes:
- /app/brau_io/api:/app/
command: /bin/bash
tty: true
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.