Skip to content

Instantly share code, notes, and snippets.

# Remove the file, which belongs to the lower layer.
rm union/javascript
# File doesn't remove from the lower layer.
ls frontend/javascript
> ls frontend/javascript
# Union filesystem creates a whiteout file in upper layer,
# It blocks the visibility of the file.
ls -lh fullstack/upper/javascript
# Initally the file "git" was not exist in upper directory.
cat fullstack/upper/git
> No such file or directory
echo "I am a version control for both frontend and backend languages" union/git
# Once we perform modification,file gets copied from "lower" to "upper" layer.
# all the modification will take place in upper layer since it was the only
# layer which has write access.
cat fullstack/upper/git
# Upper layer, doesn't contain the file "git"
cat fullstack/git
"No such file or directory"
# Lower layer L1
cat frontend/git
"I am a version control for frontend languages."
# Lower layer L2
cat backend/git
# Since we are simulating image layers through "backend" and "frontend" directories so mounting is
# being performed as read-only mode.
foo@bar:~$ mount -o ro backend-dev backend
mount -o ro frontend-dev frontend
# "fullstack" directory is simulating the container layer so it should be writable.
mount fullstack-dev fullstack
# Create workdir
# 1. mount backend-dev on union mountpoint
mount backend-dev union
ls union
git java lost+found
# 2. mount frontend-dev on same mountpoint
mount frontend-dev union
ls union
git javascript lost+found
# 1. Create base directories.
mkdir -p backend frontend fullstack union
# 2. Create virtual disk partitions
dd if=/dev/zero of=backend-dev bs=1024 count=1024
dd if=/dev/zero of=frontend-dev bs=1024 count=1024#
dd if=/dev/zero of=fullstack-dev bs=1024 count=1024
# 3. Create different file-systems
mkfs -t ext2 backend-dev
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
"aws_secret_key": "{{env `AWS_SECRET_KEY`}}",
"aws_region": "{{env `REGION`}}",
"aws_source_ami": "{{env `AMI`}}",
"aws_instance_type": "t2.medium",
"organization": "{{env `ORGANIZATION`}}",
"ssh_username": "{{env `MAIN_USER`}}"
},