简体   繁体   English

在 Docker 中不断重启容器

[英]Continuously restart container in Docker

I am working on ARMv7 Processor rev 2 (v7l) and I have some troubles with Docker.我正在开发 ARMv7 Processor rev 2 (v7l),但我在使用 Docker 时遇到了一些麻烦。
I did soft link the Docker Root Directory to /media/sd (SD card).我确实将 Docker 根目录软链接到/media/sd (SD 卡)。 Now I am installing Grafana (software) on it.现在我正在其上安装 Grafana(软件)。 I have trouble with continuously restarting container on it.我在不断重新启动容器时遇到了麻烦。

This is what I did:这就是我所做的:

docker run -d -p 3000:3000 --name=grafana --restart=on-failure grafana/grafana

What I got?我得到了什么? Logs from docker: (docker logs grafana):来自 docker 的日志:(docker logs grafana):

standard_init_linux.go:211: exec user process caused "exec format error" standard_init_linux.go:211: exec 用户进程导致“exec 格式错误”
standard_init_linux.go:211: exec user process caused "exec format error" standard_init_linux.go:211: exec 用户进程导致“exec 格式错误”
standard_init_linux.go:211: exec user process caused "exec format error" standard_init_linux.go:211: exec 用户进程导致“exec 格式错误”
standard_init_linux.go:211: exec user process caused "exec format error" standard_init_linux.go:211: exec 用户进程导致“exec 格式错误”
standard_init_linux.go:211: exec user process caused "exec format error" standard_init_linux.go:211: exec 用户进程导致“exec 格式错误”
standard_init_linux.go:211: exec user process caused "exec format error" standard_init_linux.go:211: exec 用户进程导致“exec 格式错误”
standard_init_linux.go:211: exec user process caused "exec format error" standard_init_linux.go:211: exec 用户进程导致“exec 格式错误”
standard_init_linux.go:211: exec user process caused "exec format error" standard_init_linux.go:211: exec 用户进程导致“exec 格式错误”
standard_init_linux.go:211: exec user process caused "exec format error" standard_init_linux.go:211: exec 用户进程导致“exec 格式错误”

Is there a way to fix things up?有没有办法解决问题?
I would be grateful.我将感激不尽。

Your problem is that you're using the wrong architecture in your setup.您的问题是您在设置中使用了错误的架构。 I assume you're either building the image on an amd64 machine and pushing this image on a remote system or pulling the image from an amd64 and transferring the image on a arm64 in a second stage.我假设您要么在 amd64 机器上构建映像并将该映像推送到远程系统上,要么从 amd64 中提取映像并在第二阶段将映像传输到 arm64 上。

In the first case, I suggest to build the image directly on the arm64 machine.第一种情况,我建议直接在arm64机器上构建镜像。 In the second case, I suggest to pull the grafana image for that specific architecture.在第二种情况下,我建议为该特定架构提取 grafana 映像。 Check the grafana page https://hub.docker.com/r/grafana/grafana/tags to get the image digest.检查 grafana 页面https://hub.docker.com/r/grafana/grafana/tags以获取图像摘要。 eg if you need to pull the image 7.2.0 for arm, you'll need to use the pull command using the image and the sha digest (in this case sha256:8c8be98e7999106471369b914a8cb9205ac2b3c43cca2f4e5cc5c792e3fbfacd).例如,如果您需要为 arm 拉取映像 7.2.0,则需要使用包含映像和 sha 摘要的 pull 命令(在本例中为 sha256:8c8be98e7999106471369b914a8cb9205ac2b3c43cca2f4e5cc5c7fabfcdc)。 In other words:换句话说:

docker pull grafana/grafana@sha256:8c8be98e7999106471369b914a8cb9205ac2b3c43cca2f4e5cc5c792e3fbfacd

docker save -o grafana.tar grafana/grafana@sha256:8c8be98e7999106471369b914a8cb9205ac2b3c43cca2f4e5cc5c792e3fbfacd

transfer the files to the remote machine将文件传输到远程机器

docker load -i grafana.tar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM