All about DataSince, DataEngineering and ComputerScience
View the Project on GitHub datainsightat/DataScience_Examples
Get images
docker pull ubuntu
View pulled images
docker image ls -a
detached
$ docker container run -d mysql
detached, custom name
$ docker container run -d --name mysql mysql
detached, port mirror
$ docker container run -d -p 8080:80 httpd
interactive
$ docker container run -it --name ubuntu ubuntu bash
$ docker container ls -a
$ docker container stop mysql
Interactive
$ docker container start -ai ubuntu
Execute command
$ docker container exec -it mysql bash
Performance containers
$ docker container stats mysql
Active processes
$ docker container top mysql
run container
$ docker container run -p 80:80 --name webhost -d nginx
view ports
$ docker container port webhost
$ docker network connect
$ docker network disconnect
$ docker network ls
$ docker network inspect
$ docker network create --driver
$ docker network connect
$ docker network disconnect
$ docker network create my_app_net
$ docker container run -d --name new_nginx --network my_app_net nginx
$ docker network inspect my_app_net
Build image
$ vim Dockerfile
from node:6-alpine
expose 3000
run apk add --update tini
run mkdir -p /usr/src/app
workdir /usr/src/app
copy package.json package.json
run npm install && npm cache clean
copy . .
cmd [tini","--","node","./bin/www"]
$ docker build -t testnode .
$ docker container run --vm -p 80:3000 testnode
$ docker tag testnode username/testing-node
$ docker push username/testing-node
$ docker commit llm alpaca-llm:latest
$ docker exec -it <container name> /bin/bash
$ xhost +
$ docker run -it --name gimp -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro gimp:0.1
https://dev.to/felipecrs/simply-run-docker-on-wsl2-3o8
$ # Ensures not older packages are installed
$ sudo apt-get remove docker docker-engine docker.io containerd runc
# Ensure pre-requisites are installed
$ sudo apt-get update
$ sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
# Adds docker apt key
$ sudo mkdir -p /etc/apt/keyrings
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# Adds docker apt repository
$ echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Refreshes apt repos
$ sudo apt-get update
# Installs Docker CE
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
# Ensures docker group exists
$ sudo groupadd docker
# Ensures you are part of it
$ sudo usermod -aG docker $USER
# Now, close your shell and open another for taking the group changes into account
$ touch /etc/wsl.conf
[boot]
systemd=true
reboot
https://securecloud.blog/2021/12/07/wsl2-use-docker-with-vscode-without-docker-desktop/
VSCode: Install 'Remote - WSL' Extension
Remote - Explorer: WSL Targets > Ubuntu > Connect to WSL
Ubuntu Remote: Install 'Docker' Extension