After the construction of the docker. the container is not displayed, why?

advertisements

I'm trying to build a docker container with log.io. If I manually run:

docker run -it node:argon -p 28777:28777 -p 28778:28778 -p 8000:80 /bin/bash

and manually run inside the command which you see in the Dockerfile then everything works perfectly and I am able to log into the service using http.

FROM node:argon

WORKDIR Logz.io/src/

RUN useradd -ms /bin/bash ubuntu

#RUN mkdir /root/.log.io \
#       && touch /root/.log.io/harvester.conf \
#       && touch /root/.log.io/log_server.conf \
#       && touch /root/.log.io/web_server.conf

#RUN chmod g+rwx /root/logzio
RUN apt-get update \
        && apt-get install -y vim net-tools

RUN npm install log.io

RUN /node_modules/log.io/bin/log.io-server &

RUN /node_modules/log.io/bin/log.io-harvester &

EXPOSE 28777
EXPOSE 28778
EXPOSE 8000

But if I run:

docker build .

The container is created, everything is installed but:

  1. When the creation finishes and I run docker ps -a, the container is not displayed (even though I get it's details when I run docker inspect).
  2. The Log.io service is unavailable when I browse to it through http.

Anyone knows what I'm doing wrong?


Docker build does not create a container, it creates an image.

If you do:

docker build -t "myimage:0.1" .

Then do

docker run -it myimage:0.1 -p 28777:28777 -p 28778:28778 -p 8000:80 /bin/bash

it will instantiate a container based on the image you just built.