英文:
For a container running on Raspberry Pi what should I put in the FROM line?
问题
> 构建Docker容器时,每次尝试构建时都出现以下错误:
> 守护程序的错误响应:当前上下文中没有构建阶段
以下是我的Dockerfile外观:
RUN apt-get update && \
apt-get -y install openvpn && \
type -p resolvconf >/dev/null || apt-get -y install resolvconf
CMD ["openvpn", "--config", "openvpnconfig.ovpn", "--script-security", "2", "--up", "/etc/openvpn/update-resolv-conf", "--down", "/etc/openvpn/update-resolv-conf"]
我看到了这个答案,它说我需要在顶部添加一个FROM
行。
我看到一些示例,其中包括诸如FROM ubuntu:14.04
或FROM ubuntu:latest
或另一个现有的镜像。<br>
由于我不是从现有镜像中拉取,那我应该放什么呢?我在树莓派上运行,所以不使用Ubuntu。
英文:
I am building a Docker container and each time I try to build it, I get this error:
> Error response from daemon: no build stage in current context
Here's what my Dockerfile looks like:
RUN apt-get update && \
apt-get -y install openvpn && \
type -p resolvconf >/dev/null || apt-get -y install resolvconf
CMD ["openvpn", "--config", "openvpnconfig.ovpn", "--script-security", "2", "--up", "/etc/openvpn/update-resolv-conf", "--down", "/etc/openvpn/update-resolv-conf"]
I saw this answer, which says I need a FROM
line at the top.
Some examples I have seen say stuff like FROM ubuntu:14.04
or FROM ubuntu:latest
or another existing image.<br>
Since I am not pulling from an existing image, what would I put there? I'm running it on a Raspberry Pi, so not using Ubuntu.
答案1
得分: 1
使用树莓派命令行,您可以尝试以下命令:
cat /proc/cpuinfo | grep model
这应该返回树莓派中使用的CPU型号,类似于 model name: ARMv7 Processor rev 4 (v7l)
。
现在使用 Variant,运行 cat /etc/os-release
命令,可能会返回“jessie”或“wheezy”变种。
这里您关心的输出是:
...
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
...
VERSION="8 (jessie)"
...
现在您可以在 dockerhub 上查找 ARMv7
或您正在使用的版本。根据您的需求,您可以选择从您的变种中拉取镜像 FROM
。
例如,如果您正在使用 ARMv7
,需要 python2.7
,并且您的变种是 jessie
,您可以将以下 FROM
添加到您的 Dockerfile
的顶部:
FROM arm32v7/python:2.7.13-jessie
英文:
With your Pi Command line you can try this command
cat /proc/cpuinfo | grep model
This should return the model of the CPU used in pi, something like model name: ARMv7 Processor rev 4 (v7l)
Now with Variant, cat /etc/os-release
,you may have “jessie” or “wheezy” variants
The output you care about here is
...
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
...
VERSION="8 (jessie)"
...
Now you can look at dockerhub for the ARMv7
or whatever you have it. And according to your need, you can select what you pull image FROM
according to your variant
For example, If you are using ARMv7
and you need python2.7
and jessie
is your variant, You can add this FROM
to the top of your Dockerfile
FROM arm32v7/python:2.7.13-jessie
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论