카타코더 Docker - Adding Docker Metadata & Labels

1 개요[ | ]

카타코더 Docker - Adding Docker Metadata & Labels
카타코더 Docker - Docker Metadata & Labels
카타코더 Docker
# 🔗 제목
카타코더 Docker/2 e
🡵 카타코더 Docker - Manage Container Log Files
🡵 카타코더 Docker - Ensuring Container Uptime With Restart Policies
🡵 카타코더 Docker - Adding Docker Metadata & Labels
🡵 카타코더 Docker - Load Balancing Containers
🡵 카타코더 Docker - Orchestration using Docker Compose
🡵 카타코더 Docker - See Container Metrics With Docker Stats
🡵 카타코더 Docker - Creating Optimised Docker Images using Multi-Stage Builds
🡵 카타코더 Docker - Formatting PS Output
🡵 카타코더 Docker - Run Docker From Rootless Users
🡵 카타코더 Docker - Learn Docker Swarm 101
🡵 카타코더 Docker - Docker Swarm Mode Playground

2 Single Label[ | ]

$ docker run -l user=12345 -d redis
89d170aa3fd6fcbf98a4cf7aa967edcb6aa5a8cfd4425c4cb19ecc24261e155b
$ docker inspect -f "{{json .Config.Labels }}" 89d170aa3fd6
{"user":"12345"}

3 External File[ | ]

$ echo 'user=123461' >> labels && echo 'role=cache' >> labels
$ cat labels
user=123461
role=cache
$ docker run --label-file=labels -d redis
7be0a3581d0f13b90c783924170ea7f01f98f3389d3a0fcd64a9fa91e1300a59
$ docker inspect -f "{{json .Config.Labels }}" 7be0a3581d0f
{"role":"cache","user":"123461"}

4 Inspect[ | ]

$ docker ps --filter "name=rd"
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
4cb76dded592        redis               "docker-entrypoint.s…"   3 minutes ago       Up 3 minutes        6379/tcp            rd
$ docker inspect -f "{{json .Config.Labels }}" rd | jq
{
  "com.katacoda.created": "automatically",
  "com.katacoda.private-msg": "magic",
  "user": "scrapbook"
}
$ docker images katacoda-label-example
REPOSITORY               TAG                 IMAGE ID            CREATED             SIZE
katacoda-label-example   latest              8b88bb20684e        4 minutes ago       112MB
$ docker inspect -f "{{json .ContainerConfig.Labels }}" katacoda-label-example | jq
{
  "com.katacoda.build-date": "2015-07-01T10:47:29Z",
  "com.katacoda.course": "Docker",
  "com.katacoda.private-msg": "HelloWorld",
  "com.katacoda.version": "0.0.5",
  "vendor": "Katacoda"
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}