我刚开始使用docker-compose
一段时间,遇到了一些我不明白的问题。我想安装net-tools
在容器上,但它似乎不像以前那样工作了。
我的 Dockerfile 如下所示:file1
FROM logstash:7.4.2
MAINTAINER [email protected]
# 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
文件2:
FROM elasticsearch:7.4.2
MAINTAINER [email protected]
# 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 文件如下所示:
版本:'2'
services:
logstash:
build: ../images/logstash
links: ["elasticsearch"]
elasticsearch:
build: ../images/elasticsearch
ports:
- "9200:9200"
当我跑步时我得到了这个:
Building elasticsearch
Step 1/4 : FROM elasticsearch:7.4.2
---> b1179d41a7b4
Step 2/4 : MAINTAINER [email protected]
---> 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 [email protected]
---> 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
我已尝试过apt-get
,但没有效果。
我该如何在 Compose 上安装软件包?