CTF-All-In-One/doc/2.1.3_docker.md
2018-11-07 16:47:38 +08:00

36 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 2.1.3 Docker
在配置 pwn 环境时,如果不想每次都用 socat那么 [ctf_xinetd](https://github.com/Eadom/ctf_xinetd) 是个不错的选择。
安装 docker
```shell
$ sudo apt install docker.io
```
ctf_xinetd 用法示例:
```shell
$ git clone https://github.com/Eadom/ctf_xinetd.git
$ sudo docker build -t "helloworld" ./ctf_xinetd/
$ sudo docker run -d -p "0.0.0.0:10001:9999" -h "helloworld" --name="helloworld" helloworld
```
docker 的一些基本操作:
```shell
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
helloworld latest 80b466e06d24 2 hours ago 372 MB
ubuntu 16.04 4a689991aa24 2 weeks ago 116 MB
$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8f8a5d22f68e helloworld "/start.sh" About a minute ago Up About a minute 0.0.0.0:10001->9999/tcp helloworld
$ sudo docker stop 8f8a5d22f68e
8f8a5d22f68e
$ sudo docker rm 8f8a5d22f68e
8f8a5d22f68e
$ sudo docker rmi 80b466e06d24
Untagged: helloworld:latest
```