简体   繁体   English

boot2docker / docker“错误。 图片库/ .:最新找不到”

[英]boot2docker / docker “Error. image library/.:latest not found”

I'm trying to create a VM with docker and boot2docker. 我正在尝试使用docker和boot2docker创建一个VM。 I've made the following Dockerfile, which I'm trying to run through the command line 我已经制作了以下Dockerfile,我正在尝试通过命令行运行

docker run Dockerfile

Immidiatly it says exactly this: 几乎是这样说的:

Unable to find image 'Dockerfile:latest' locally
FATA[0000] Invalid repository name <Dockerfile>, only [a-z0-9_.] are allowed

Dockerfile: Dockerfile:

FROM ubuntu:latest

#Oracle Java7 install
RUN apt-get install software-properties-common -y
RUN apt-get update
RUN add-apt-repository -y ppa:webupd8team/java
RUN apt-get update
RUN echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select                        true | /usr/bin/debconf-set-selections
RUN apt-get install -y oracle-java7-installer

#Jenkins install
RUN wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo      apt-key add -
RUN sudo echo "deb http://pkg.jenkins-ci.org/debian binary/" >>  /etc/apt/sources.list
RUN apt-get update
RUN apt-get install --force-yes -y jenkins
RUN sudo service jenkins start

#Zip support install
RUN apt-get update
RUN apt-get -y install zip

#Unzip hang.zip
RUN unzip -o /var/jenkins/hang.zip -d /var/lib/jenkins/
RUN chown -R jenkins:jenkins /vaR/lib/jenkins
RUN service jenkins restart
EXEC tail -f /etc/passwd


EXPOSE 8080

I am in the directory where the Dockerfile is, when trying to run this command. 尝试运行此命令时,我位于Dockerfile所在的目录中。

Ignore the zip part, as that's for later use 忽略zip部分,以备后用

You should run docker build first (which actually uses your Dockerfile ): 您应该先运行Dockerfile docker build (实际上使用Dockerfile ):

docker build --tag=imagename .

Or 要么

docker build --tag=imagename -f yourDockerfile .

Then you would use that image tag to docker run it: 然后,您将使用该图像标签对docker run它:

docker run imagename

There are tools that can provide this type of feature. 有一些工具可以提供这种类型的功能。 We have achieved using docker compose, though you have to go through 我们已经使用docker compose实现了,尽管您必须经历

(https://docs.docker.com/compose/overview/) 

docker-compose up

but you can also do as work around 但您也可以解决

$ docker build -t foo . && docker run foo.

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

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