CUSP PUI - Class 1
Extension of UCSL bootcamp
- Mohit Sharma
CUSP 2018
Coursework
CUSP 2018
Using ADRF
Using Docker Image
Hands On
Before we proceed:
1. Mac users: https://download.docker.com/mac/stable/Docker.dmg
2. Windows users: https://download.docker.com/win/stable/Docker%20for%20Windows%20Installer.exe
3. Linux users: https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce
CUSP 2018
Using Docker Image
What is
container
decouples
infrastructure
portable
scalable
platform-independent
high-density
Deployment
CUSP 2018
Using Docker Image
BareMetal
VM
Container
Demystifying
CUSP 2018
Using Docker Image
Platform
Independent
Container 1
Container 2
Container 3
Laptop, Amazon EC[X], GKE, Azure, CUSP Compute^, Kubernetes/Swarm cluster...
^ will be available soon
Demystifying
Using Docker Image
Demystifying
Container
What is a
Made of ?
(Layered) Image
Ubuntu
Python3
Jupyter
(current)
Using Docker Image
Demystifying
How to access the data?
Container
Storage
Local Storage/ Network Storage
Bind
Volume
preferred
CUSP 2018
CUSP 2018
Demystifying
HANDS ON
Demystifying
HANDS ON
- Download the github repo: https://github.com/Mohitsharma44/ucsl-image - Make sure you have done the following: # created an account on https://hub.docker.com # installed docker # installed docker-compose^ # pulled the ucsl-image (docker pull mohitsharma44/ucsl-image:latest)
^ Linux users: - sudo curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose. - sudo chmod +x /usr/local/bin/docker-compose
Demystifying
HANDS ON
Make sure everything is working docker --version docker-compose --version
:Make sure you get No Errors:
Demystifying
HANDS ON
Fire up the container
cd ucsl-image/image
docker-compose up
(you can pass -d flag to run it as daemon)
Laptop, Amazon EC[X], GKE, Azure, CUSP Compute^, Kubernetes/Swarm cluster...
HANDS ON
Demystifying
Saving the Current state of Container
docker commit -m "Added x package" ucsl-container mohitsharma44/ucsl-image:latest
docker commit -m <commit_msg> <container_id/name>
<repository>:[tag]
e.g.
CUSP 2018
Demystifying
Pushing an image to a registry^
docker push mohitsharma44/ucsl-image:latest
docker push <repository>:[tag]
e.g.
CUSP 2018
^ We will be using docker hub, so create an account first.
^ You may also need to type docker login in the terminal.
HANDS ON
Demystifying
Stopping^ the container
docker stop ucsl-container -t 5
docker stop <container_name/id> [-t time_to_kill]
e.g.
^ Just stopping the container will not delete your data
CUSP 2018
HANDS ON
Demystifying
Stopping and Removing the container
docker rm -f ucsl-container
docker rm -f <container_name/id>
e.g.
^ To remove an already stopped container, don't use -f flag
CUSP 2018
HANDS ON
CUSP 2018
CUSP 2018
Learning by doing
Fire up your terminal
Mac: Cmd + Space <type> Terminal Windows: Start -> run -> <type> cmd Linux (maybe?): Ctrl + Alt + T
CUSP 2018
Learning by doing
1. Open your File Browser
2. go to Downloads directory
GUI
Terminal
cd ~/Downloads
~ is the expansion of your home directory
Changing directory
CUSP 2018
Learning by doing
1. Open your File Browser
2. go to Downloads directory
GUI
Terminal
ls -lht ~/Downloads
~ is the expansion of your home directory
long format
human readable format
sort by time
Listing contents of a directory
CUSP 2018
Learning by doing
1. Open your File Browser
2. Go to Downloads
3. Click on New Folder.
4.Name it PUIrocks
GUI
Terminal
mkdir ~/Downloads/PUIrocks
~ is the expansion of your home directory
Creating directorY
CUSP 2018
Learning by doing
1. Open your File Browser
2. Go to Downloads
3. Right-Click on PUIrocks -> Delete
GUI
Terminal
rm -rf ~/Downloads/PUIrocks
~ is the expansion of your home directory
Removing directories
recursive
force
CUSP 2018
Learning by doing
1. Open your File Browser
GUI
Terminal
pwd
current working directory
CUSP 2018
Learning by doing
1. Open your File Browser
2. Go to A, Right Click -> Copy
3. Go to B, Right Click -> Paste
GUI
Terminal
cp -rp /path/to/A /path/to/B
copying files from A to B
recursive
preserve:
timestamps
ownership
mode
CUSP 2018
Learning by doing
1. Open your File Browser
2. Go to A, Right Click -> Move
3. Go to B, Right Click -> Paste
GUI
Terminal
mv /path/to/A /path/to/B
Moving files from A to B
Mac doesn't have Move to option
CUSP 2018
Learning by doing
1. Open your File Browser
2. Go to Directory with the file.
3. Open the file
GUI
Terminal
more /path/to/file
Print contents of file
cat -l /path/to/file
line numbers
less /path/to/file
most /path/to/file
CUSP 2018
Learning by doing
1. Open your File Browser
2. Type string in search bar
GUI
Terminal
grep -rli "foo" /path/to/*.py
Find a string in File/ Directory
recursively
file name
ignore case
wild card
CUSP 2018
Learning by doing
1. fuhgeddaboudit
GUI
redirecting I/O
Learning by doing
redirect output of one command as an input to the next
Counting number of directories
ls ~/Downloads | wc -l
pipe
line count
Output to a file
echo "Hello World" > myfile.txt
echo "Bye" >> myfile.txt
overwrite
append
Learning by doing
process manipulation
List all processes
ps -ef
Find your specific process
ps aux
OR
CUSP 2018
ps -ef | grep -i <parent_process>
Learning by doing
process manipulation
Kill specific Process
CUSP 2018
1. ps -ef | grep -i <parent_process>
2. kill -9 <pid>
OR
pkill -9 <name>
# | SIGXXX |
---|---|
2 | SIGINT |
9 | SIGKILL |
Learning by doing
history
Access history
CUSP 2018
history
reverse-i-search
ctrl + r
CUSP PUI - Class 2018
By mohit sharma
CUSP PUI - Class 2018
- 2,079