Skip to content

Commit

Permalink
support docker's memory swap option
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschipp committed Jul 30, 2015
1 parent 8e61846 commit 19eac9a
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion ADMIN.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ gpasswd -a training islet
# Container Configuration
VIRTUSER="demo" # Account used when container is entered (Must exist in container!)
CPUSHARES="1024" # Proportion of cpu share allocation per container
MEMORY="256m" # Amount of memory allocated to each container
MEMORY="256m" # Amount of memory allocated to each container
SWAP="100m" # Amount of swap memory allocated to each container
HOSTNAME="bro" # Set hostname in container. PS1 will end up as $VIRTUSER@$HOSTNAME:~$ in shell
NETWORK="none" # Disable networking by default: none; Enable networking: bridge
DNS="127.0.0.1" # Use loopback when networking is disabled to prevent error messages from resolver
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: default help install uninstall pull update logo mrproper package

PROG = islet
VERSION = 1.2.0
VERSION = 1.3.0
CONFIG_DIR = /etc/$(PROG)
INSTALL_DIR = /opt/$(PROG)
LIB_DIR = $(INSTALL_DIR)/lib
Expand Down
3 changes: 2 additions & 1 deletion bin/islet_login
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ check_ulimits(){
# CPUSHARES - from ISLET config files, relative cpu share allocation per container
# CPUSET - from ISLET config files, cpu's available for container
# MEMORY - from ISLET config files, memory allocation per container
# SWAP - from ISLET config files, swap memory allocation per container
# NETWORK - from ISLET config files, network settings for container
# DNS - from ISLET config files, nameservers for container
# GLOBAL_OPTIONS - from ISLET config files, pass docker options to all containers
Expand Down Expand Up @@ -674,7 +675,7 @@ start_container(){
check_ulimits

local NAME_OPT="--name="${BASENAME}.${USERNAME}" --tty --hostname $HOSTNAME"
local RES_OPT="--cpu-shares ${CPUSHARES:-$CPU} --cpuset ${CPUSET:-0} --memory ${MEMORY:-$RAM}"
local RES_OPT="--cpu-shares ${CPUSHARES:-$CPU} --cpuset-cpus ${CPUSET:-0} --memory ${MEMORY:-$RAM} --memory-swap ${SWAP:--1}"
local NET_OPT="$PUBLISH --net $NETWORK --dns $DNS --add-host $HOSTNAME:127.0.0.1"
local GLB_OPT="$GLOBAL_OPTIONS"
local OTH_OPT="$LOCAL_OPTIONS"
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ check_docker_version()
{
if ! echo ${MISSING[@]} | grep -q docker; then
echo -n "${BULLET} Checking docker version... "
docker version | grep -q 'Server version: 1.[3-9]' && echo "$YES 1.3+ found"|| echo "$NO 1.3+ not found"
docker version | grep -q 'Server version: 1.[7-9]' && echo "$YES 1.7+ found"|| echo "$NO 1.7+ not found"
fi
}

Expand Down
1 change: 1 addition & 0 deletions docs/islet.5
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ DAYS=3 # Container lifetime specified in days, r
VIRTUSER="demo" # Account used when container is entered (Must exist in container!)
CPUSHARE=1024 # Proportion of cpu share allocation per container (Option used to be CPU)
MEMORY="256m" # Amount of memory allocated to each container (Option used to be RAM)
SWAP="100m" # Amount of swap memory allocated to each container
HOSTNAME="bro" # Set hostname in container. PS1 will end up as $VIRTUSER@$HOSTNAME:~$ in shell
NETWORK="none" # Disable networking by default: none; Enable networking: bridge
DNS="127.0.0.1" # Use loopback when networking is disabled to prevent error messages from resolver
Expand Down
1 change: 1 addition & 0 deletions extra/argus.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DAYS="3" # Container lifetime spe
VIRTUSER="demo" # Account used when container is entered (Must exist in container!)
CPUSHARES="1024" # Proportion of cpu share allocation per container
MEMORY="256m" # Amount of memory allocated to each container
SWAP="10m" # Amount of swap memory allocated to each container
HOSTNAME="argus" # Set hostname in container. PS1 will end up as $VIRTUSER@$HOSTNAME:~$ in shell
NETWORK="none" # Disable networking by default: none; Enable networking: bridge
DNS="127.0.0.1" # Use loopback when networking is disabled to prevent error messages from resolver
Expand Down
1 change: 1 addition & 0 deletions extra/brolive.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DAYS="3" # Container lifetime spe
VIRTUSER="demo" # Account used when container is entered (Must exist in container!)
CPUSHARES="1024" # Proportion of cpu share allocation per container
MEMORY="256m" # Amount of memory allocated to each container
SWAP="10m" # Amount of swap memory allocated to each container
HOSTNAME="bro" # Set hostname in container. PS1 will end up as $VIRTUSER@$HOSTNAME:~$ in shell
NETWORK="none" # Disable networking by default: none; Enable networking: bridge
DNS="127.0.0.1" # Use loopback when networking is disabled to prevent error messages from resolver
Expand Down
1 change: 1 addition & 0 deletions extra/ids.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DAYS="3" # Container lifetime spe
VIRTUSER="demo" # Account used when container is entered (Must exist in container!)
CPUSHARES="1024" # Proportion of cpu share allocation per container
MEMORY="256m" # Amount of memory allocated to each container
SWAP="10m" # Amount of swap memory allocated to each container
HOSTNAME="ids" # Set hostname in container. PS1 will end up as $VIRTUSER@$HOSTNAME:~$ in shell
NETWORK="none" # Disable networking by default: none; Enable networking: bridge
DNS="127.0.0.1" # Use loopback when networking is disabled to prevent error messages from resolver
Expand Down
1 change: 1 addition & 0 deletions extra/netsniff-ng.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DAYS="3" # Container lifetime spe
VIRTUSER="demo" # Account used when container is entered (Must exist in container!)
CPUSHARES="1024" # Proportion of cpu share allocation per container
MEMORY="256m" # Amount of memory allocated to each container
SWAP="10m" # Amount of swap memory allocated to each container
HOSTNAME="netsniff-ng" # Set hostname in container. PS1 will end up as $VIRTUSER@$HOSTNAME:~$ in shell
NETWORK="none" # Disable networking by default: none; Enable networking: bridge
DNS="127.0.0.1" # Use loopback when networking is disabled to prevent error messages from resolver
Expand Down
1 change: 1 addition & 0 deletions extra/ossec.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DAYS="3" # Container lifetime spe
VIRTUSER="root" # Account used when container is entered (Must exist in container!)
CPUSHARES="1024" # Proportion of cpu share allocation per container
MEMORY="256m" # Amount of memory allocated to each container
SWAP="10m" # Amount of swap memory allocated to each container
HOSTNAME="ossec" # Set hostname in container. PS1 will end up as $VIRTUSER@$HOSTNAME:~$ in shell
NETWORK="none" # Disable networking by default: none; Enable networking: bridge
DNS="127.0.0.1" # Use loopback when networking is disabled to prevent error messages from resolver
Expand Down
1 change: 1 addition & 0 deletions extra/sagan.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ TIMEOUT="6h" # Max runtime of contain
VIRTUSER="demo" # Account used when container is entered (Must exist in image!)
CPUSHARES="1024" # Proportion of cpu share allocation per container
MEMORY="100m" # Amount of memory allocated to each container
SWAP="10m" # Amount of swap memory allocated to each container
HOSTNAME="sagan" # Set hostname in container. PS1 will end up as $VIRTUSER@$HOSTNAME:~$ in shell
NETWORK="none" # Disable networking by default: none; Enable networking: bridge
DNS="127.0.0.1" # Use loopback when networking is disabled to prevent error messages from resolver
Expand Down
1 change: 1 addition & 0 deletions extra/tcpdump.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DAYS="3" # Container lifetime spe
VIRTUSER="demo" # Account used when container is entered (Must exist in container!)
CPUSHARES="1024" # Proportion of cpu share allocation per container
MEMORY="256m" # Amount of memory allocated to each container
SWAP="10m" # Amount of swap memory allocated to each container
HOSTNAME="tcpdump" # Set hostname in container. PS1 will end up as $VIRTUSER@$HOSTNAME:~$ in shell
NETWORK="none" # Disable networking by default: none; Enable networking: bridge
DNS="127.0.0.1" # Use loopback when networking is disabled to prevent error messages from resolver
Expand Down
1 change: 1 addition & 0 deletions extra/volatility.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DAYS="3" # Container lifetime spe
VIRTUSER="demo" # Account used when container is entered (Must exist in container!)
CPUSHARES="1024" # Proportion of cpu share allocation per container
MEMORY="256m" # Amount of memory allocated to each container
SWAP="10m" # Amount of swap memory allocated to each container
HOSTNAME="volatility" # Set hostname in container. PS1 will end up as $VIRTUSER\@$HOSTNAME:~$ in shell
NETWORK="none" # Disable networking by default: none; Enable networking: bridge
DNS="127.0.0.1" # Use loopback when networking is disabled to prevent error messages from resolver
Expand Down

0 comments on commit 19eac9a

Please sign in to comment.