Add minimal Docker image build instructions

Update README to include instructions for building from source a minimal Docker image with only ctop.
This commit is contained in:
Scott Hansen 2017-03-16 11:53:45 -07:00 committed by GitHub
parent e2bc4d0a08
commit 19b212f45d

View File

@ -53,6 +53,26 @@ glide install && \
go build
```
To build a minimal Docker image containing only `ctop`, follow the build instructions above up through `glide install`, then:
```bash
CGO_ENABLED=0 go build -a
[[ ! -d docker-build ]] && mkdir docker-build
cd docker-build && cp ../ctop ./
cat > Dockerfile <<- "EOF"
FROM scratch
COPY ./ctop /ctop
ENTRYPOINT ["/ctop"]
EOF
docker build -t ctop .
```
Now you can run ctop as above:
```bash
docker run -ti --name ctop --rm -v /var/run/docker.sock:/var/run/docker.sock ctop
```
## Usage
`ctop` requires no arguments and will configure itself using the `DOCKER_HOST` environment variable