From b240a47ac841098cfa48cb3d924684cd1cbfa0a4 Mon Sep 17 00:00:00 2001 From: Peter Wilmott
Date: Mon, 27 Jul 2015 19:04:14 +0100
Subject: [PATCH] Implement 'bocker pull' for Docker Hub integration
---
README.md | 61 ++++++++++++++++++++++-------------------------
bocker | 24 +++++++++++++++----
tests/teardown | 2 +-
tests/test_images | 2 +-
tests/test_pull | 16 +++++++++++++
5 files changed, 66 insertions(+), 39 deletions(-)
create mode 100644 tests/test_pull
diff --git a/README.md b/README.md
index 316dce1..ac0c1f4 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,7 @@ Docker implemented in 100 lines of bash.
The following packages are needed to run bocker.
* btrfs-progs
+* curl
* iproute2
* iptables
* util-linux >= 2.25.2
@@ -34,30 +35,33 @@ Even if you meet the above prerequisites you probably still want to **run bocker
## Example Usage
```
-$ bocker init base-image/
-Created: img_84632
+$ bocker pull centos 7
+######################################################################## 100.0%
+######################################################################## 100.0%
+######################################################################## 100.0%
+Created: img_42150
$ bocker images
-IMAGE_ID
-img_84632
+IMAGE_ID SOURCE
+img_42150 centos:7
-$ bocker run img_84632 uname -sro
-Linux 3.10.0-123.20.1.el7.x86_64 GNU/Linux
+$ bocker run img_42150 cat /etc/centos-release
+CentOS Linux release 7.1.1503 (Core)
$ bocker ps
CONTAINER_ID COMMAND
-ps_12277 uname -sro
+ps_42045 cat /etc/centos-release
-$ bocker logs ps_12277
-Linux 3.10.0-123.20.1.el7.x86_64 GNU/Linux
+$ bocker logs ps_42045
+CentOS Linux release 7.1.1503 (Core)
-$ bocker rm ps_12277
-Removed: ps_12277
+$ bocker rm ps_42045
+Removed: ps_42045
-$ bocker run img_84632 which wget
+$ bocker run img_42150 which wget
which: no wget in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
-$ bocker run img_84632 yum install -y wget
+$ bocker run img_42150 yum install -y wget
Installing : wget-1.14-10.el7_0.1.x86_64 1/1
Verifying : wget-1.14-10.el7_0.1.x86_64 1/1
Installed : wget.x86_64 0:1.14-10.el7_0.1
@@ -65,35 +69,25 @@ Complete!
$ bocker ps
CONTAINER_ID COMMAND
-ps_14099 which wget
-ps_43377 yum install -y wget
+ps_42018 yum install -y wget
+ps_42182 which wget
-$bocker commit ps_43377 img_84632
-Removed: img_84632
-Created: img_84632
+$ bocker commit ps_42018 img_42150
+Removed: img_42150
+Created: img_42150
-$ bocker run img_84632 which wget
+$ bocker run img_42150 which wget
/usr/bin/wget
-
-$ bocker rm ps_14099
-Removed: ps_14099
-
-$ bocker rm ps_43377
-Removed: ps_43377
-
-$ bocker rm ps_95942
-Removed: ps_95942
-
-$ bocker rm img_84632
-Removed: img_84632
```
## Functionality: Currently Implemented
* `docker build` †
+* `docker pull`
* `docker images`
* `docker ps`
* `docker run`
+* `docker exec`
* `docker logs`
* `docker commit`
* `docker rm` / `docker rmi`
@@ -103,9 +97,10 @@ Removed: img_84632
## Functionality: Not Yet Implemented
-* Port Forwarding
-* Data Volumes
* Data Volume Containers
+* Data Volumes
+* Port Forwarding
+* Quota Support / CGroups
## License
diff --git a/bocker b/bocker
index 0484261..0c6cfac 100755
--- a/bocker
+++ b/bocker
@@ -4,26 +4,42 @@ btrfs_path='/var/bocker';
function bocker_check() {
btrfs subvolume list "$btrfs_path" | grep -qw "$1" && echo 0 || echo 1
}
-function bocker_init() { #HELP Create an image:\nBOCKER init