Docker Community Forums

Share and learn in the Docker community.

Automation using chef


(Rshri) #1

Hii,
I am trying to automate some installs on docker containers using chef. But I am new to chef, so can any one help me out with basic installations or steps for configuring chef or suggest any related sites.

Will really a great help if anyone could guide.

Regards.


(Timgriffiths) #2

This is by far the best docker cookbook i have found for chef

The very short version is you install docker using the docker_service LWRP to install and configure the engine (there a so many flags to fiddle with to meet your needs)

docker_service 'default' do
    action [:create, :start]
end

Then depending on how much you want chef to deploy your environment, you can look at commands like this.

docker_image 'busybox' do
  action :pull
end

docker_container 'an echo server' do
  repo 'busybox'
  port '1234:1234'
  command "nc -ll -p 1234 -e /bin/cat"
end

Happy Chef’ing