2018-04-29 21:21:55 +07:00
|
|
|
|
# 2.1.3 Docker
|
2018-11-07 15:47:38 +07:00
|
|
|
|
|
|
|
|
|
在配置 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
|
|
|
|
|
```
|