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:
- When the creation finishes and I run
docker ps -a
, the container is not displayed (even though I get it's details when I rundocker inspect
).- 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.
When you finish building an image
from a Dockerfile, a container will not be readily available. You will need to create a container
from the image
that was created
You can see your images with the command docker images
From this list of images, you can create your container via docker run ...
If your docker container is not visible after running it, something is likely failing in your build and that would stem from your Dockerfile.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With