Skip to content

file containing docker commands and other linux commands

Notifications You must be signed in to change notification settings

atharva-vyas/cheatsheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Docker Commands and Utilities

docker --version
systemctl start docker

To expose a port, run the following command along with other commands below:

  • -p <host_machine_port_that_is_free>:<docker_image_port_to_expose>
  • Example: docker run -t -d -p 3000:27017 --name myCustomImage debian
docker pull <os_name>
docker run -t -d --name <image_name> <os_name>
docker ps -a
docker exec -it <image_name> /bin/sh
docker stop <image_name>
docker start <image_name>

docker stats

docker image
docker image ls
docker rm -f <image_id>

docker ps -a
docker inspect <container_name> | grep IPAddress

DOCKER COMMIT:

docker commit <container_id> <docker_useraname>/<repository_name>:<version_name (use:- latest)>
docker push  <docker_useraname>/<repository_name>:<version_name>
docker images
docker image rm --force <docker_commit_image_id>

Add GUI to your docker container:

xhost +
docker run -t -d --net=host --env="DISPLAY" --volume="$HOME/.Xauthority:/root/.Xauthority:rw" --name test debian

AFTER INSTALL:

apt update -y && apt upgrade -y && apt --fix-broken install && apt autoremove -y && apt install systemd -y

apt-get install libgtk2.0-dev -y
apt --fix-broken install
apt-get install python3-pip python-dev -y
apt install wget -y && apt install fish -y && apt install nano -y && apt install curl -y && apt install vim -y

apt install nodejs -y && apt install npm -y && npm cache clean -f && npm install -g n && npx n stable && hash -r && node --version

Make Fish Default

To make fish default shell, first run: which fish Then take the output of the command above and type this: chsh -s <command_from_the_step_above>

When running a .sh file, add this to the top: #!/bin/sh

TMUX

tmux attach -t 0
  • Navigate around all windows & sessions -- ctrl+B, W
  • Overview of all windows & sessions -- ctrl+B, S
  • Delete a window from the navigation -- ctrl+B, X
  • New window -- ctrl+B, C
  • Change window -- ctrl+B, N
  • Change window name -- ctrl+B, ,
  • Delete a window -- ctrl+B, &
  • Detach -- ctrl+B, D
  • Split vertically(hotdog) -- ctrl+B, %
  • Split vertically(hamburger) -- ctrl+B, "
  • Move around -- ctrl+B, ↑ ↓ → ←
  • Move around -- ctrl+B, Q
  • Move around -- ctrl+B, NUMBER
  • Change size of panel -- ctrl+B, ctrl+↑ ↓ → ←
  • Pre-selected layouts -- ctrl+B, alt+NUMBER
  • Delete a panel -- ctrl+B, X
  • List all sessions -- tmux ls
  • Start session -- tmux new -s nameHere
  • Start session & window -- tmux new -t nameHere
  • Kill session -- tmux kill-session -t nameHere
  • Change session number rename-session -t [old-number] [new-number]

Miscellaneous

How to download files using cli: wget -O [file name with extension] [url]

  • Example: wget -O filename.html googl.com

Copy files between host and container: docker cp [souce dir] [containerID]:[docker dir to copy to]

  • Example: docker cp '/home/atharvavyas/Downloads/data.csv' 'abc123:/home/'

Install VS-Code Extensions for the docker image:

  1. Hit: Ctrl+Shift+P to open command palette
  2. Search: "Remote: Install Local Extensions" and select the first option
  3. Select all extensions, and click OK; Then wait for all the extensions to install

Python conda:

conda create --name <name_for_your_env> python=<python_version>
conda activate <your_env>
conda info --envs
conda install <package_name> (like tensorflow, requests, etc.)
conda remove <package_name>
conda deactivate
conda env remove -n <your_environment_name>

conda after install: (execute commands in bash)

Python pyenv Virtual Environment:

pyenv install 3.10.0
pyenv virtualenv 3.10.0 myproject
pyenv activate myproject
which python
which pip

pyenv virtualenv-delete <name_of_your_env>
pyenv versions

Adds "open tilix here" to nautilus:

GitHub Issue Comment

Just use:

sudo apt install python3-nautilus
killall nautilus

and reopen nautilus, then right click to see the option.

How to keep EC2 instance running after SSH is terminated

Test API GET and POST requests:

https://httpbin.org/get

About

file containing docker commands and other linux commands

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages