Docker
- [[Podman]]
- [[Kubernetes]]
- [[Docker-Compose]]
Examples
- [Docker Run Reference](https://docs.docker.com/engine/reference/commandline/run/)
- Run a Container and remove after:
```bash
docker run --rm -it ubuntu:latest bash
```
- Expose port **container:8080** on **host:80**:
```bash
docker run --rm -it -p 80:8080 ubuntu:latest bash
```
- Mount a volume:
https://docs.docker.com/storage/volumes/
```bash
docker run --rm -it -v /local/path:/mount/path ubuntu:latest bash
```
- Delete all images [source](https://stackoverflow.com/questions/44785585/docker-how-to-delete-all-local-docker-images):
```bash
docker rmi -f $(docker images -aq)
```
-
Capabilities
-
Dockerfile
-
Multi-Stage Builds
WORKDIR /go/src/github.com/alexellis/href-counter/
RUN go get -d -v golang.org/x/net/html
COPY app.go .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /go/src/github.com/alexellis/href-counter/app .
CMD ["./app"]
NFS
- Mount an NFS Volume with Docker Compose
```yaml
version: '2'
volumes:
nfs_volume_name:
driver: local
driver_opts:
type: nfs4
o: "addr=192.168.0.xxx,rw,noatime,rsize=8192,wsize=8192,tcp,timeo=14"
device: ":path/to/volume"
services:
image_name:
image: "image:latest"
volumes:
- nfs_volume_name:/data/test_nfs
```
- https://stackoverflow.com/questions/45282608/how-to-directly-mount-nfs-share-volume-in-container-using-docker-compose-v3
```yaml
version: "3.2"
services:
rsyslog:
image: jumanjiman/rsyslog
ports:
- "514:514"
- "514:514/udp"
volumes:
- type: volume
source: example
target: /nfs
volume:
nocopy: true
volumes:
example:
driver_opts:
type: "nfs"
o: "addr=10.40.0.199,nolock,soft,rw"
device: ":/docker/example"
```
Docker Compose
- [Documentation](https://docs.docker.com/compose/)
Registry
- [Documentation](https://docs.docker.com/registry/)
Network
- https://iximiuz.com/en/posts/container-networking-is-simple/
-