Skip to content

Latest commit

 

History

History
 
 

build_image

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Fabricio: Building Docker images

This example shows how to deploy configuration consisting of a single container based on custom image which automatically built from provided Dockerfile.

Requirements

  • Fabricio 0.3.17 or greater
  • Vagrant
  • One from the list of Vagrant supported providers (this example was tested with VirtualBox)
  • Docker for Linux/Mac/Windows
  • Docker registry which runs locally on 5000 port, this can be reached out by executing following docker command: docker run --name registry --publish 5000:5000 --detach registry:2

Virtual Machine creation

Run vagrant up and wait until VM will be created.

Files

  • Dockerfile, used for building image
  • fabfile.py, Fabricio configuration
  • README.md, this file
  • Vagrantfile, Vagrant config

List of available commands

fab --list

Deploy

fab my_nginx

At first, this will initiate creation of a new Virtual Machine (if not created yet) using Vagrant configuration. Then deploy itself will start.

Parallel execution

Any Fabricio command can be executed in parallel mode. This mode provides advantages when you have more then one host to deploy to. Use --parallel option if you want to run command on all hosts simultaneously:

fab --parallel my_nginx

Customization

See also "Hello, World" Customization section.

Custom Dockerfile

You can provide custom folder with Dockerfile by passing build_path parameter:

build_path='path_to_folder_with_dockerfile'

Issues

  • If you see warnings in Vagrant logs about Guest Extensions version is not match VirtualBox version try to install vagrant-vbguest plugin that automatically installs Guest Extensions of version which corresponds to your version of VirtualBox: vagrant plugin install vagrant-vbguest
  • Windows users may fall into trouble with VirtualBox and Hyper-V, the latter is used by "native" Docker for Windows. Try to disable Hyper-V and use Docker Toolbox instead in such case