markdown 泊坞窗,片段

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 泊坞窗,片段相关的知识,希望对你有一定的参考价值。

## Docker

### Start a container with a shell and mounted folder
```sh
docker run -it -v <shared_folder>:<mounting_path> <image>
```

### Get IP of running container
```sh
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container_name_or_id>
```

### Disable address randomization
If GDB gives the error `warning: Error disabling address space randomization: Operation not permitted` than run the image with the following flags

```sh
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
```

### Start an exited container
```sh
docker start -a <container_ID>
```

Sometimes the container doesn't work at all after this command, in that case run:

```sh
docker restart <container_ID>
docker attach <container_ID>
```

### Give access to host USB or serial device
```sh
docker run -it --device=/dev/ttyUSB0 <image>
```

### Create container from Dockerfile

Assuming there is a valid `Dockerfile` in the current folder, just run

```sh
docker build -t container_name .
```

### Adding volume to existing container

```sh
docker commit 5a8f89adeead newimagename
docker run -it -v "$PWD/dir1":/dir1 -v "$PWD/dir2":/dir2 newimagename
```

以上是关于markdown 泊坞窗,片段的主要内容,如果未能解决你的问题,请参考以下文章

markdown 泊坞窗常用命令

markdown 泊坞窗コマンド

markdown 泊坞窗常用命令

markdown 泊坞窗,撰写

markdown 泊坞窗基础

markdown 泊坞窗,gitlab部署