---
# System prepended metadata

title: 'Docker commend:'

---

# Docker commend:


## Add user to Docker`s group
```
sudo groupadd docker
sudo usermod -aG docker <Username>
sudo systemctl restart docker
sudo chmod 666 /var/run/docker.sock
```
**docker bulid**
```
docker build -t name . --no-cache
```
**jupyter**
```
jupyter notebook --ip 0.0.0.0 --no-browser --allow-root


jupyter serverextension enable --py jupyterlab --sys-prefix
jupyter lab --ip 0.0.0.0 --no-browser --allow-root
```
**SEARCH commend**

Show image:
```
$ docker images
```
Show running containers:
```
$ docker ps
```
Show all containers:
```
$ docker ps -a
```
**DELETE commend**

Delete image:
```
$ docker rmi <IMAGE_NAME>
```

Delete container:
```
$ docker rm <CONTAINER_NAME>
```

**RUN commend**

>PARAMETER
• NV_GPU=0,1 #choice mapping GPU
• -ti #get Container bash
• -d #running Container background，no Output
• --rm #when Container stop rm Container
• --name #name Container
• -p HOST_PORT:CONTAINER_PORT #Port Mapping
• -v HOST_PATH:CONTAINER_PATH #Mount file

>GPU Mapping(NVIDIA-DOCKER1.X)
• NV_GPU=0,1

example
```
NV_GPU=0,1 nvidia-docker run –ti –v /host:/container nvidia/cuda 
```

>GPU Mapping(NVIDIA-DOCKER2.X)
• –e NVIDIA_VISIBLE_DEVICES=0,1

example
```
docker run --runtime=nvidia --name name -e NVIDIA_VISIBLE_DEVICES=0 -ti –v /host:/containe nvidia/cuda
```

sudo aa-remove-unknown
