Abhishek Pandey
Abhishek Pandey

Reputation: 399

How to create Dockerfile in Boot2docker to create an image

Can any one guide me how to create and edit a Dockerfile in boot2docker to create my own image? I am not sure which commands to use to edit the Dockerfile when in Boot2Docker shell.

Upvotes: 0

Views: 768

Answers (2)

Bryan
Bryan

Reputation: 12200

A Dockerfile is simply a text file with line-by-line instructions to build an image. So you edit it with any text editor.

See the Docker page for further details on what to put inside.

Upvotes: 0

Jean-Baptiste Louazel
Jean-Baptiste Louazel

Reputation: 525

I wonder why you are looking to create your Dockerfile directly from the boot2docker shell. Once boot2docker is installed on your computer, you can directly create normally a Dockerfile from your shell. To do so, follow my steps :

  1. Launch boot2docker and exports the env variables as requested (copy and paste the last three lines) Boot2docker up

  2. Write the simplest test Dockerfile you can! Dockerfile

  3. Build it (we will call our image 'test') Build

  4. Let's run our image Run

Now you just have to adapt my example to do what you want. Keep in mind that in this example the container we launched is now stopped because nothing kept it alive. For most common cases, you will have something (like a server) which will keep your container running. I hope it will help you!

Upvotes: 1

Related Questions