Skip to content

Commit

Permalink
Add DOCKER_RAMDISK environment variable to make Docker work when the …
Browse files Browse the repository at this point in the history
…root is on a ramdisk, closes #83
  • Loading branch information
bflad committed Mar 15, 2014
1 parent b2e530d commit 92ca9aa
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This release includes Docker 0.9.0 changes and defaults, such as setting exec_dr
* Enhancement: [#81][]: Docker 0.9.0: Add a -G option to specify the group which unix sockets belong
* Enhancement: [#82][]: Docker 0.9.0: Add -f flag to docker rm to force removal of running containers
* Enhancement: Add -f flag for docker rmi to force removal of images
* Enhancement: [#83][]: Docker 0.9.0: Add DOCKER_RAMDISK environment variable to make Docker work when the root is on a ramdisk
* Enhancement: [#84][]: Docker 0.9.0: Add -e flag for execution driver
* Enhancement: [#86][]: Add Chefspec LWRP matchers

Expand Down Expand Up @@ -361,6 +362,7 @@ Lots of community contributions this release -- thanks!
[#78]: https://github.com/bflad/chef-docker/issues/78
[#81]: https://github.com/bflad/chef-docker/issues/81
[#82]: https://github.com/bflad/chef-docker/issues/82
[#83]: https://github.com/bflad/chef-docker/issues/83
[#84]: https://github.com/bflad/chef-docker/issues/84
[#86]: https://github.com/bflad/chef-docker/issues/86
[@jcrobak]: https://github.com/jcrobak
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ init_type | Init type for docker ("runit", "systemd", "sysv", or "upstart") | St
install_dir | Installation directory for docker binary | String | auto-detected (see attributes/default.rb)
install_type | Installation type for docker ("binary", "package" or "source") | String | "package"
options | Additional options to pass to docker. These could be flags like "-api-enable-cors". | String | nil
ramdisk | Set DOCKER_RAMDISK when using RAM disk | TrueClass or FalseClass | false
registry_cmd_timeout | registry LWRP default cmd_timeout seconds | Fixnum | 60
storage_driver | Storage driver for docker (nil, "aufs", or "devicemapper") | String | auto-detected (see attributes/default.rb)
version | Version of docker | String | nil
Expand Down
1 change: 1 addition & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
default['docker']['group_members'] = []
default['docker']['http_proxy'] = nil
default['docker']['image_cmd_timeout'] = 300
default['docker']['ramdisk'] = false
default['docker']['registry_cmd_timeout'] = 60

default['docker']['init_type'] = value_for_platform(
Expand Down
3 changes: 3 additions & 0 deletions templates/default/docker.service.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ After=network.target

[Service]
Type=simple
<% if node['docker']['ramdisk'] -%>
Environment="DOCKER_RAMDISK=<%= node['docker']['ramdisk'] %>"
<% end -%>
<% if node['docker']['http_proxy'] -%>
Environment="HTTP_PROXY=<%= node['docker']['http_proxy'] %>"
<% end -%>
Expand Down
4 changes: 4 additions & 0 deletions templates/default/docker.sysconfig.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ DOCKER_OPTS="$DOCKER_OPTS -e <%= node['docker']['exec_driver'] %>"
DOCKER_OPTS="$DOCKER_OPTS -G <%= node['docker']['group'] %>"
<% end -%>
<% if node['docker']['ramdisk'] -%>
DOCKER_RAMDISK=<%= node['docker']['ramdisk'] %>
<% end -%>

# If you need Docker to use an HTTP proxy, it can also be specified here.
<% if node['docker']['http_proxy'] -%>
export HTTP_PROXY=<%= node['docker']['http_proxy'] %>
Expand Down
3 changes: 3 additions & 0 deletions templates/default/sv-docker-run.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh
exec 2>&1
<% if node['docker']['ramdisk'] -%>
export DOCKER_RAMDISK=<%= node['docker']['ramdisk'] %>
<% end -%>
<% if node['docker']['http_proxy'] -%>
export HTTP_PROXY=<%= node['docker']['http_proxy'] %>
<% end -%>
Expand Down

0 comments on commit 92ca9aa

Please sign in to comment.