U
U
user.2019-04-16 22:14:38
linux
user., 2019-04-16 22:14:38

How to find the reason for the failure to launch your docker container?

Good evening,
I created a simple container based on the Linux distribution Alpine added a few
docker build -t username/scaner:v0.1 .
utilities
docker images
I needed
docker run -d MYIMAGEID sh
:
it is not active (ps), but it hangs in the list of stopped (ps -a). How to see all the logs at startup in order to understand what the problem is, below I give my config, maybe someone will immediately understand what the problem is.
2. I need to add my script written in Python to my image, but it is not on git, I think how to do it more competently, add a script and then just commit?
Dockerfile

# This is a comment
FROM mhart/alpine-node
MAINTAINER Kate Smith <[email protected]>

RUN apk update
RUN apk add nmap git 
RUN git clone https://github.com/vulnersCom/nmap-vulners.git

RUN apk add --no-cache \
  ca-certificates \
  libpcap-dev

ENV MASSCAN_VERSION 1.0.5

RUN set -x \
  && apk add --no-cache --virtual .build-deps \
    build-base \
    clang \
    clang-dev \
    git \
    linux-headers \
  && rm -rf /var/lib/apt/lists/* \
  && git clone --depth 1 --branch "$MASSCAN_VERSION" https://github.com/robertdavidgraham/masscan.git /usr/src/masscan \
  && ( \
  cd /usr/src/masscan \
  && make \
  && make install \
  ) \
  && rm -rf /usr/src/masscan \
  && apk del .build-deps

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Kudryavtsev, 2019-04-17
@kumaxim

1. The fact is that after starting, I see the id of the newly created container, but it is not in the list of active (ps), but it hangs in the list of stopped (ps -a). How to see all the logs at startup in order to understand what the problem is, below I give my config, maybe someone will immediately understand what the problem is.

Look, when you run docker run... your newly created container will execute the command given after the image name. This command will work, make some result and end. Since there are no more active processes inside your container, docker will stop your container as unnecessary. That's how it works. If you want to see the logs of your container, then see the manual on the docker logs command
If you need to build the image once on your local machine, then see the ADD / COPY manual . If you need to build this image on a CI server or your colleagues will need it in the future, upload it to git

D
Denis, 2019-04-22
@Norkotik

Dig in the direction of PID=1, as soon as the process with this pid ends, the container goes out.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question