Extension of UCSL bootcamp
- Mohit Sharma
CUSP 2018
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
container
decouples
infrastructure
portable
scalable
platform-independent
high-density
Deployment
CUSP 2018
BareMetal
VM
Container
CUSP 2018
Platform
Independent
Container 1
Container 2
Container 3
Laptop, Amazon EC[X], GKE, Azure, CUSP Compute^, Kubernetes/Swarm cluster...
^ will be available soon
Container
(Layered) Image
Ubuntu
Python3
Jupyter
(current)
How to access the data?
Container
Storage
Local Storage/ Network Storage
Bind
Volume
preferred
CUSP 2018
CUSP 2018
- 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
Make sure everything is working docker --version docker-compose --version
:Make sure you get No Errors:
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...
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
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.
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
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
CUSP 2018
CUSP 2018
Fire up your terminal
Mac: Cmd + Space <type> Terminal Windows: Start -> run -> <type> cmd Linux (maybe?): Ctrl + Alt + T
CUSP 2018
1. Open your File Browser
2. go to Downloads directory
GUI
Terminal
cd ~/Downloads
~ is the expansion of your home directory
CUSP 2018
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
CUSP 2018
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
CUSP 2018
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
recursive
force
CUSP 2018
1. Open your File Browser
GUI
Terminal
pwd
CUSP 2018
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
recursive
preserve:
timestamps
ownership
mode
CUSP 2018
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
Mac doesn't have Move to option
CUSP 2018
1. Open your File Browser
2. Go to Directory with the file.
3. Open the file
GUI
Terminal
more /path/to/file
cat -l /path/to/file
line numbers
less /path/to/file
most /path/to/file
CUSP 2018
1. Open your File Browser
2. Type string in search bar
GUI
Terminal
grep -rli "foo" /path/to/*.py
recursively
file name
ignore case
wild card
CUSP 2018
1. fuhgeddaboudit
GUI
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
List all processes
ps -ef
Find your specific process
ps aux
OR
CUSP 2018
ps -ef | grep -i <parent_process>
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 |
Access history
CUSP 2018
history
reverse-i-search
ctrl + r