Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

boot2docker / docker "Error. image library/.:latest not found"

I'm trying to create a VM with docker and boot2docker. I've made the following Dockerfile, which I'm trying to run through the command line

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:

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.

Ignore the zip part, as that's for later use

like image 787
Detilium Avatar asked May 04 '15 07:05

Detilium


2 Answers

You should run docker build first (which actually uses your 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 imagename
like image 176
VonC Avatar answered Nov 02 '22 15:11

VonC


There are tools that can provide this type of feature. We have achieved using docker compose, though you have to go through

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

docker-compose up

but you can also do as work around

$ docker build -t foo . && docker run foo.
like image 1
Anuj Singh Avatar answered Nov 02 '22 15:11

Anuj Singh