I'm starting to work with Docker now, I understand the concepts of images and containers but I have a problem to run the command:
$ docker-compose up
I created a Dockerfile
in the root of my project to create a container with the main components that I need for my application to run:
FROM ubuntu:xenial-20180525
MAINTAINER Matheus Freitas <[email protected]>
RUN mkdir /home/sog-imn/
ADD . /home/sog-imn
WORKDIR /home/sog-imn
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get install -y erlang
RUN apt-get install -y rabbitmq-server
RUN apt-get install -y default-jdk
RUN apt-get install -y maven
RUN bash nodesource_setup.sh && apt-get install -y nodejs
RUN apt-get install -y build-essential
RUN npm install bower -g
RUN npm install gulp-cli -g
RUN npm install gulp -D
RUN npm install less -g
RUN npm install browser-sync -g
EXPOSE 8081
I made the composition of Dockerfile with docker-compose.yml
, creating networks:
version: '3'
services:
app:
build: .
ports:
- "8081:80"
networks:
- backend
db:
image: postgres:9.6
volumes:
- db-data:/var/lib/postgresql/data
networks:
- postegres
networks:
backend:
postegres:
volumes:
db-data:
When I run the command:
$ docker-compose up
Apparently everything is right in the console log ...
MacBook-Pro-de-Matheus:sog-imn matheusfreitas$ docker-compose up
Creating sog-imn_app_1 ... done
Creating sog-imn_db_1 ... done
Attaching to sog-imn_app_1, sog-imn_db_1
sog-imn_app_1 exited with code 0
db_1 | LOG: database system was shut down at 2018-06-18 13:38:31 UTC
db_1 | LOG: MultiXact member wraparound protections are now enabled
db_1 | LOG: autovacuum launcher started
db_1 | LOG: database system is ready to accept connections
When I run the command:
$ docker ps -a
The Conatiner App has status e
Exited (0) 6 seconds ago
I do not understand why, I would like some more information about the possible problems that I may be causing and if possible tips on how to solve these problems.