Dockerfile Install Package Not Working

Dockerfile Install Package Not Working

I just started docker-compose after a while and am having issues I don't understand. I want to install net-tools on the container, but it does not seem to work like it used to.

my Dockerfile looks like this: file1

FROM logstash:7.4.2
MAINTAINER 
# RUN  npm install -g bower && npm install --global gulp-cli

RUN uname -a
# RUN apt-get update && apt-get install -y bash
# RUN apt-get update 
RUN apk add net-tools

file 2:

FROM elasticsearch:7.4.2
MAINTAINER 
# RUN  npm install -g bower && npm install --global gulp-cli

# RUN  apt-get update -y && apt-get upgrade -y
# RUN apk update
# RUN apk add --update net-tools
# RUN apk-install add 
RUN uname -a
EXPOSE 9200

docker-compose file looks like this:

version: '2'

services:
    logstash:
        build: ../images/logstash
        links: ["elasticsearch"]

    elasticsearch:
        build: ../images/elasticsearch
        ports:
            - "9200:9200"

When I run I get this:

Building elasticsearch
Step 1/4 : FROM elasticsearch:7.4.2
 ---> b1179d41a7b4
Step 2/4 : MAINTAINER 
 ---> Using cache
 ---> 6a0133725b92
Step 3/4 : RUN uname -a
 ---> Using cache
 ---> 93c87715f6ab
Step 4/4 : EXPOSE 9200
 ---> Using cache
 ---> cd7479be90ef
Successfully built cd7479be90ef
Successfully tagged topology_elasticsearch:latest
Building logstash
Step 1/4 : FROM logstash:7.4.2
 ---> 642b82780655
Step 2/4 : MAINTAINER 
 ---> Using cache
 ---> bd9aa12c7c53
Step 3/4 : RUN uname -a
 ---> Using cache
 ---> 6f4d7fdc0624
Step 4/4 : RUN apk add net-tools
 ---> Running in b3fdd2c42836
/bin/sh: apk: command not found
ERROR: Service 'logstash' failed to build: The command '/bin/sh -c apk add net-tools' returned a non-zero code: 127

I have tried apt-get but is not working.

How am I supposed to install packages on compose?

1
Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.