我正在尝试在docker容器中安装grafana,但遇到权限被拒绝的错误。以下是详细信息:
sudo docker build -t grafana:latest .
Sending build context to Docker daemon 5.12 kB
Step 1/8 : FROM grafana/grafana:6.3.5
---> 2017e1eb54fa
Step 2/8 : RUN apt-get update && apt-get install -y curl gettext-base && rm -rf /var/lib/apt/lists/*
---> Running in 4c3b0835bb22
Reading package lists...
E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)
The command '/bin/sh -c apt-get update && apt-get install -y curl gettext-base && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100
我尝试使用sudo运行它,但是没有用。我也尝试过
RUN sudo apt-get update && apt-get install -y curl gettext-base && rm -rf /var/lib/apt/lists/*
但是这也不起作用。
下面是dockerfile
FROM grafana/grafana:6.3.5
RUN apt-get update && apt-get install -y curl gettext-base && rm -rf /var/lib/apt/lists/*
WORKDIR /etc/grafana
COPY datasources ./datasources
WORKDIR /app
COPY entrypoint.sh ./
RUN chmod u+x entrypoint.sh
ENTRYPOINT ["/app/entrypoint.sh"]
答案 0 :(得分:0)
尝试一下:
FROM grafana/grafana:6.3.5
USER root
RUN apt-get update && apt-get install -y curl gettext-base && rm -rf /var/lib/apt/lists/*
USER grafana
WORKDIR /etc/grafana
COPY datasources ./datasources
WORKDIR /app
COPY entrypoint.sh ./
RUN chmod u+x entrypoint.sh
ENTRYPOINT ["/app/entrypoint.sh"]
图片使用默认用户:grafana
答案 1 :(得分:0)
您可以尝试docker commit
将更改永久保存。比使用dockerfile
构建新图像更容易。
首先,您应该进入容器,然后进行更改,例如升级或更改配置,最后提交更改。
host$ docker exec -it "container_name/id" bash
container# apt-get update
host$ docker commit "container_name/id" my-grafana
您可以使用docker image ls