Skip to content

Commit

Permalink
Add the first assignment
Browse files Browse the repository at this point in the history
[refs #8119de507184]
  • Loading branch information
jfahrer committed May 5, 2018
1 parent adf6c39 commit 406aece
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions persisting_data/assignment1.md
@@ -0,0 +1,9 @@
## Access volumes from multiple containers
* Create a named volume
* Start an alpine container
* Execute a shell
* Mount the volume to /data
* Create a file in /data (`touch /data/test.file`)
* Start a second alpine container
* Execute a shell
* Mount the SAME volume

1 comment on commit 406aece

@Zaph0001
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker container run -it --volume alpine-volume:/data alpine:latest sh
/ # dh -f
sh: dh: not found
/ # df -h
Filesystem Size Used Available Use% Mounted on
overlay 58.4G 2.6G 52.8G 5% /
tmpfs 64.0M 0 64.0M 0% /dev
tmpfs 994.6M 0 994.6M 0% /sys/fs/cgroup
shm 64.0M 0 64.0M 0% /dev/shm
/dev/sda1 58.4G 2.6G 52.8G 5% /data
/dev/sda1 58.4G 2.6G 52.8G 5% /etc/resolv.conf
/dev/sda1 58.4G 2.6G 52.8G 5% /etc/hostname
/dev/sda1 58.4G 2.6G 52.8G 5% /etc/hosts
tmpfs 994.6M 0 994.6M 0% /proc/acpi
tmpfs 64.0M 0 64.0M 0% /proc/kcore
tmpfs 64.0M 0 64.0M 0% /proc/keys
tmpfs 64.0M 0 64.0M 0% /proc/timer_list
tmpfs 64.0M 0 64.0M 0% /proc/sched_debug
tmpfs 994.6M 0 994.6M 0% /sys/firmware
/ # touch /data/test.file
/ # ls
bin dev home media opt root sbin sys usr
data etc lib mnt proc run srv tmp var
/ # ls data
test.file
/ #
C:\Users\Daphne>docker volume ls
DRIVER VOLUME NAME
local alpine-volume
local my-volume
local other-volume
local test-volume

C:\Users\Daphne>docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
40ac1ce36f9b alpine:latest "sh" 3 minutes ago Up 3 minutes ecstatic_lehmann
37359e77010c alpine:latest "/bin/sh" 23 hours ago Up 23 hours wizardly_robinson

C:\Users\Daphne>docker container run -it --volume alpine-volume:/data alpine:latest sh
/ # df -h
Filesystem Size Used Available Use% Mounted on
overlay 58.4G 2.6G 52.8G 5% /
tmpfs 64.0M 0 64.0M 0% /dev
tmpfs 994.6M 0 994.6M 0% /sys/fs/cgroup
shm 64.0M 0 64.0M 0% /dev/shm
/dev/sda1 58.4G 2.6G 52.8G 5% /data
/dev/sda1 58.4G 2.6G 52.8G 5% /etc/resolv.conf
/dev/sda1 58.4G 2.6G 52.8G 5% /etc/hostname
/dev/sda1 58.4G 2.6G 52.8G 5% /etc/hosts
tmpfs 994.6M 0 994.6M 0% /proc/acpi
tmpfs 64.0M 0 64.0M 0% /proc/kcore
tmpfs 64.0M 0 64.0M 0% /proc/keys
tmpfs 64.0M 0 64.0M 0% /proc/timer_list
tmpfs 64.0M 0 64.0M 0% /proc/sched_debug
tmpfs 994.6M 0 994.6M 0% /sys/firmware
/ # ls data
test.file
/ #

Please sign in to comment.