{"id":3882,"date":"2026-11-19T09:43:36","date_gmt":"2026-11-19T00:43:36","guid":{"rendered":"https:\/\/qol-kk.com\/wp2\/?p=3882"},"modified":"2026-11-19T09:43:36","modified_gmt":"2026-11-19T00:43:36","slug":"20261116-plan092","status":"publish","type":"post","link":"https:\/\/qol-kk.com\/wp2\/blog\/2026\/11\/19\/20261116-plan092\/","title":{"rendered":"Docker\u306e\u30b3\u30f3\u30c6\u30ca\u9593\u901a\u4fe1\u5165\u9580\uff1a\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u8a2d\u5b9a\u3068\u540d\u524d\u89e3\u6c7a\u306e\u4ed5\u7d44\u307f"},"content":{"rendered":"<h2>\u6982\u8981<\/h2>\n<p>Docker \u3067 Web \u30b5\u30fc\u30d0\u30fc\u30fb\u30a2\u30d7\u30ea\u30fbDB \u3092\u5225\u3005\u306e\u30b3\u30f3\u30c6\u30ca\u306b\u5206\u3051\u305f\u3068\u304d\u3001\u591a\u304f\u306e\u4eba\u304c\u6700\u521d\u306b\u3064\u307e\u305a\u304f\u306e\u304c\u300c\u30b3\u30f3\u30c6\u30ca\u540c\u58eb\u304c\u7e4b\u304c\u3089\u306a\u3044\u300d\u554f\u984c\u3067\u3059\u3002\u539f\u56e0\u306f\u4e3b\u306b\u6b21\u306e 3 \u3064\u3067\u3059\u3002<\/p>\n<ul>\n<li>\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u7a2e\u985e\uff08\u30c7\u30d5\u30a9\u30eb\u30c8 bridge \u304b\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u304b\uff09<\/li>\n<li>\u63a5\u7d9a\u5148\u306e\u6307\u5b9a\uff08<code>localhost<\/code> \u3092\u4f7f\u3063\u3066\u3044\u308b\u3001\u516c\u958b\u5074\u306e\u30dd\u30fc\u30c8\u3092\u4f7f\u3063\u3066\u3044\u308b\uff09<\/li>\n<li>\u76f8\u624b\u306e\u30b3\u30f3\u30c6\u30ca\u304c\u63a5\u7d9a\u3092\u53d7\u3051\u4ed8\u3051\u3089\u308c\u308b\u72b6\u614b\u306b\u306a\u3063\u3066\u3044\u306a\u3044<\/li>\n<\/ul>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001Docker \u306e\u5185\u8535 DNS \u306b\u3088\u308b\u540d\u524d\u89e3\u6c7a\u306e\u4ed5\u7d44\u307f\u3092\u8aac\u660e\u3057\u305f\u3046\u3048\u3067\u3001<code>docker run<\/code> \u3068 Docker Compose \u305d\u308c\u305e\u308c\u3067\u306e\u30b3\u30f3\u30c6\u30ca\u9593\u901a\u4fe1\u306e\u8a2d\u5b9a\u65b9\u6cd5\u3068\u78ba\u8a8d\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<h2>\u74b0\u5883<\/h2>\n<p>\uff08\u4eee\u7f6e\u304d: \u4ee5\u4e0b\u306e\u74b0\u5883\u3092\u60f3\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u3088\u3063\u3066\u7d30\u304b\u3044\u6319\u52d5\u304c\u9055\u3046\u5834\u5408\u304c\u3042\u308a\u307e\u3059\uff09<\/p>\n<ul>\n<li>Docker Engine 24 \u4ee5\u964d<\/li>\n<li>Docker Compose v2\uff08<code>docker compose<\/code> \u30b3\u30de\u30f3\u30c9\uff09<\/li>\n<li>Linux \/ macOS\uff08Docker Desktop\uff09<\/li>\n<\/ul>\n<h2>\u3088\u304f\u3042\u308b\u300c\u7e4b\u304c\u3089\u306a\u3044\u300d\u30d1\u30bf\u30fc\u30f3<\/h2>\n<h3>\u30d1\u30bf\u30fc\u30f31: \u30b3\u30f3\u30c6\u30ca\u540d\u3067\u5f15\u3051\u306a\u3044<\/h3>\n<pre class=\"lang:default decode:true\">docker run -d --name web nginx:1.27\ndocker run --rm busybox:1.36 wget -qO- http:\/\/web\n# wget: bad address 'web'<\/pre>\n<p><code>web<\/code> \u3068\u3044\u3046\u30b3\u30f3\u30c6\u30ca\u304c\u52d5\u3044\u3066\u3044\u308b\u306e\u306b\u3001\u305d\u306e\u540d\u524d\u304c\u89e3\u6c7a\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<h3>\u30d1\u30bf\u30fc\u30f32: <code>localhost<\/code> \u3067\u7e4b\u304c\u3089\u306a\u3044<\/h3>\n<p>\u30db\u30b9\u30c8\u4e0a\u3067\u76f4\u63a5\u52d5\u304b\u3057\u3066\u3044\u305f\u3068\u304d\u306e <code>DB_HOST=localhost<\/code> \u306e\u307e\u307e\u30a2\u30d7\u30ea\u3092\u30b3\u30f3\u30c6\u30ca\u306b\u3059\u308b\u3068\u3001DB \u306b\u7e4b\u304c\u3089\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u30d1\u30bf\u30fc\u30f33: \u30dd\u30fc\u30c8\u756a\u53f7\u304c\u9055\u3046<\/h3>\n<p><code>ports: \"15432:5432\"<\/code> \u3067\u516c\u958b\u3057\u3066\u3044\u308b DB \u306b\u5bfe\u3057\u3066\u3001\u30a2\u30d7\u30ea\u5074\u304b\u3089 <code>db:15432<\/code> \u3067\u7e4b\u3054\u3046\u3068\u3057\u3066\u5931\u6557\u3057\u307e\u3059\u3002<\/p>\n<h2>\u539f\u56e0<\/h2>\n<h3>\u30b3\u30f3\u30c6\u30ca\u306e <code>localhost<\/code> \u306f\u30b3\u30f3\u30c6\u30ca\u81ea\u8eab<\/h3>\n<p>\u30b3\u30f3\u30c6\u30ca\u3054\u3068\u306b\u72ec\u7acb\u3057\u305f\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u540d\u524d\u7a7a\u9593\u304c\u3042\u308a\u307e\u3059\u3002\u30b3\u30f3\u30c6\u30ca\u306e\u4e2d\u306e <code>localhost<\/code>\uff08127.0.0.1\uff09\u304c\u6307\u3059\u306e\u306f<strong>\u305d\u306e\u30b3\u30f3\u30c6\u30ca\u81ea\u8eab<\/strong>\u3067\u3001\u30db\u30b9\u30c8\u3084\u4ed6\u306e\u30b3\u30f3\u30c6\u30ca\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h3>\u30c7\u30d5\u30a9\u30eb\u30c8 bridge \u306b\u306f\u540d\u524d\u89e3\u6c7a\u304c\u306a\u3044<\/h3>\n<p>\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u6307\u5b9a\u305b\u305a\u306b <code>docker run<\/code> \u3057\u305f\u30b3\u30f3\u30c6\u30ca\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e <code>bridge<\/code> \u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u7e4b\u304c\u308a\u307e\u3059\u3002\u3053\u3053\u3067\u306f IP \u30a2\u30c9\u30ec\u30b9\u3067\u306f\u901a\u4fe1\u3067\u304d\u307e\u3059\u304c\u3001<strong>\u30b3\u30f3\u30c6\u30ca\u540d\u3067\u306e\u540d\u524d\u89e3\u6c7a\u306f\u3067\u304d\u307e\u305b\u3093<\/strong>\uff08<code>--link<\/code> \u306f\u30ec\u30ac\u30b7\u30fc\u6a5f\u80fd\u3068\u3044\u3046\u6271\u3044\u3067\u3059\uff09\u3002<\/p>\n<h3>\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u306f\u5185\u8535 DNS \u304c\u3042\u308b<\/h3>\n<p><code>docker network create<\/code> \u3067\u4f5c\u3063\u305f\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3067\u306f\u3001Docker \u306e\u5185\u8535 DNS \u30b5\u30fc\u30d0\u30fc\uff08\u30b3\u30f3\u30c6\u30ca\u304b\u3089\u898b\u305f\u30a2\u30c9\u30ec\u30b9\u306f <code>127.0.0.11<\/code>\uff09\u304c\u4f7f\u3048\u307e\u3059\u3002\u540c\u3058\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u3044\u308b\u30b3\u30f3\u30c6\u30ca\u540d\u3084\u30a8\u30a4\u30ea\u30a2\u30b9\u3092 IP \u30a2\u30c9\u30ec\u30b9\u306b\u5909\u63db\u3057\u3001\u5916\u90e8\u306e\u30c9\u30e1\u30a4\u30f3\u540d\u306f\u30db\u30b9\u30c8\u5074\u306e DNS \u8a2d\u5b9a\u306b\u5f93\u3063\u3066\u8ee2\u9001\u3057\u307e\u3059\u3002<\/p>\n<h3><code>ports<\/code> \u306f\u30db\u30b9\u30c8\u304b\u3089\u5165\u308b\u305f\u3081\u306e\u8a2d\u5b9a<\/h3>\n<p><code>\"15432:5432\"<\/code> \u306f\u300c\u30db\u30b9\u30c8\u306e 15432 \u756a \u2192 \u30b3\u30f3\u30c6\u30ca\u306e 5432 \u756a\u300d\u3068\u3044\u3046\u8ee2\u9001\u306e\u8a2d\u5b9a\u3067\u3059\u3002\u30b3\u30f3\u30c6\u30ca\u540c\u58eb\u306e\u901a\u4fe1\u306f\u3053\u306e\u8ee2\u9001\u3092\u7d4c\u7531\u3057\u306a\u3044\u306e\u3067\u3001<strong>\u30b3\u30f3\u30c6\u30ca\u5074\u306e\u30dd\u30fc\u30c8\uff085432\uff09\u3092\u76f4\u63a5\u6307\u5b9a\u3057\u307e\u3059<\/strong>\u3002<\/p>\n<h2>\u5bfe\u5fdc\u65b9\u6cd5<\/h2>\n<ol>\n<li>\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u4f5c\u308a\u3001\u901a\u4fe1\u3055\u305b\u305f\u3044\u30b3\u30f3\u30c6\u30ca\u3092\u540c\u3058\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u53c2\u52a0\u3055\u305b\u308b<\/li>\n<li>\u63a5\u7d9a\u5148\u306b\u306f\u30b3\u30f3\u30c6\u30ca\u540d\uff08Compose \u306a\u3089\u30b5\u30fc\u30d3\u30b9\u540d\uff09\u3092\u6307\u5b9a\u3059\u308b<\/li>\n<li>\u30dd\u30fc\u30c8\u306f\u30b3\u30f3\u30c6\u30ca\u5074\u306e\u30dd\u30fc\u30c8\u756a\u53f7\u3092\u4f7f\u3046<\/li>\n<li>\u8d77\u52d5\u9806\u3060\u3051\u3067\u306a\u304f\u3001\u76f8\u624b\u304c\u63a5\u7d9a\u3092\u53d7\u3051\u4ed8\u3051\u3089\u308c\u308b\u72b6\u614b\u306b\u306a\u3063\u305f\u304b\u3069\u3046\u304b\u3082\u8003\u3048\u308b<\/li>\n<\/ol>\n<h2>\u5b9f\u88c5\u4f8b<\/h2>\n<h3>docker run \u306e\u5834\u5408<\/h3>\n<pre class=\"lang:default decode:true\"># \u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u4f5c\u6210\ndocker network create demo-net\n\n# \u540c\u3058\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u53c2\u52a0\u3055\u305b\u3066\u8d77\u52d5\ndocker run -d --name web --network demo-net nginx:1.27\n\n# \u5225\u30b3\u30f3\u30c6\u30ca\u304b\u3089\u30b3\u30f3\u30c6\u30ca\u540d\u3067\u758e\u901a\u78ba\u8a8d\ndocker run --rm --network demo-net busybox:1.36 wget -qO- http:\/\/web\n# \u2192 nginx \u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u30da\u30fc\u30b8\u306e HTML \u304c\u8fd4\u308b<\/pre>\n<p>\u8d77\u52d5\u6e08\u307f\u306e\u30b3\u30f3\u30c6\u30ca\u306f\u3001\u5f8c\u304b\u3089\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u8ffd\u52a0\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">docker network connect demo-net existing-container<\/pre>\n<p>\u30b3\u30f3\u30c6\u30ca\u540d\u3068\u306f\u5225\u306e\u540d\u524d\u3067\u3082\u5f15\u3051\u308b\u3088\u3046\u306b\u3059\u308b\u306b\u306f\u3001\u30a8\u30a4\u30ea\u30a2\u30b9\u3092\u4ed8\u3051\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">docker run -d --name pg1 --network demo-net --network-alias database \\\n  -e POSTGRES_PASSWORD=\"$POSTGRES_PASSWORD\" postgres:16\n# \u540c\u3058\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u5185\u304b\u3089\u306f \"pg1\" \u3067\u3082 \"database\" \u3067\u3082\u5f15\u3051\u308b<\/pre>\n<h3>Docker Compose \u306e\u5834\u5408\uff08\u6700\u5c0f\u69cb\u6210\uff09<\/h3>\n<p>Compose \u306f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3054\u3068\u306b <code>&lt;\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u540d&gt;_default<\/code> \u3068\u3044\u3046\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u81ea\u52d5\u3067\u4f5c\u308a\u3001\u3059\u3079\u3066\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u305d\u3053\u306b\u7e4b\u304e\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u4f55\u3082\u8a2d\u5b9a\u3057\u306a\u304f\u3066\u3082<strong>\u30b5\u30fc\u30d3\u30b9\u540d\u3067\u901a\u4fe1\u3067\u304d\u307e\u3059<\/strong>\u3002<\/p>\n<pre class=\"lang:default decode:true\"># compose.yaml\nservices:\n  app:\n    build: .\/app\n    environment:\n      DB_HOST: db      # \u30b5\u30fc\u30d3\u30b9\u540d\u3092\u305d\u306e\u307e\u307e\u30db\u30b9\u30c8\u540d\u3068\u3057\u3066\u4f7f\u3046\n      DB_PORT: \"5432\"  # \u30b3\u30f3\u30c6\u30ca\u5074\u306e\u30dd\u30fc\u30c8\n  db:\n    image: postgres:16\n    environment:\n      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}  # \u5024\u306f .env \u306a\u3069\u304b\u3089\u6e21\u3059<\/pre>\n<h3>Docker Compose \u306e\u5834\u5408\uff08\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u5206\u5272 + \u8d77\u52d5\u5f85\u3061\uff09<\/h3>\n<pre class=\"lang:default decode:true\"># compose.yaml\nservices:\n  web:\n    image: nginx:1.27\n    ports:\n      - \"8080:80\"          # \u30db\u30b9\u30c8\u304b\u3089\u5165\u308b\u53e3\u306f\u3053\u3053\u3060\u3051\n    networks:\n      - frontend\n\n  app:\n    build: .\/app\n    environment:\n      DB_HOST: database\n      DB_PORT: \"5432\"\n    networks:\n      - frontend\n      - backend\n    depends_on:\n      db:\n        condition: service_healthy   # DB \u304c healthy \u306b\u306a\u308b\u307e\u3067\u5f85\u3064\n\n  db:\n    image: postgres:16\n    environment:\n      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}\n    healthcheck:\n      test: [\"CMD-SHELL\", \"pg_isready -U postgres\"]\n      interval: 5s\n      timeout: 3s\n      retries: 10\n    networks:\n      backend:\n        aliases:\n          - database\n\nnetworks:\n  frontend:\n  backend:\n    internal: true            # \u3053\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u304b\u3089\u306f\u5916\u90e8\u306b\u51fa\u3089\u308c\u306a\u3044<\/pre>\n<p>\u3053\u306e\u69cb\u6210\u3067\u306e\u901a\u4fe1\u306e\u53ef\u5426\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>\u901a\u4fe1<\/th>\n<th>\u53ef\u5426<\/th>\n<th>\u7406\u7531<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>web \u2192 app<\/td>\n<td>\u25cb<\/td>\n<td>\u3069\u3061\u3089\u3082 <code>frontend<\/code> \u306b\u53c2\u52a0<\/td>\n<\/tr>\n<tr>\n<td>app \u2192 db<\/td>\n<td>\u25cb<\/td>\n<td>\u3069\u3061\u3089\u3082 <code>backend<\/code> \u306b\u53c2\u52a0\uff08<code>db<\/code> \/ <code>database<\/code> \u3067\u5f15\u3051\u308b\uff09<\/td>\n<\/tr>\n<tr>\n<td>web \u2192 db<\/td>\n<td>\u00d7<\/td>\n<td>\u5171\u901a\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u304c\u306a\u3044<\/td>\n<\/tr>\n<tr>\n<td>\u30db\u30b9\u30c8 \u2192 db<\/td>\n<td>\u00d7<\/td>\n<td><code>ports<\/code> \u3092\u516c\u958b\u3057\u3066\u3044\u306a\u3044<\/td>\n<\/tr>\n<tr>\n<td>db \u2192 \u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8<\/td>\n<td>\u00d7<\/td>\n<td><code>backend<\/code> \u306f <code>internal: true<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u5225\u306e Compose \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3068\u901a\u4fe1\u3057\u305f\u3044\u5834\u5408<\/h3>\n<pre class=\"lang:default decode:true\">docker network create shared-net<\/pre>\n<pre class=\"lang:default decode:true\">services:\n  app:\n    networks:\n      - shared\n\nnetworks:\n  shared:\n    external: true\n    name: shared-net<\/pre>\n<h2>\u78ba\u8a8d\u65b9\u6cd5<\/h2>\n<h3>\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3068\u53c2\u52a0\u30b3\u30f3\u30c6\u30ca<\/h3>\n<pre class=\"lang:default decode:true\">docker network ls\ndocker network inspect demo-net<\/pre>\n<p><code>inspect<\/code> \u306e\u7d50\u679c\u306b\u3042\u308b <code>Containers<\/code> \u3067\u3001\u53c2\u52a0\u3057\u3066\u3044\u308b\u30b3\u30f3\u30c6\u30ca\u3068 IP \u30a2\u30c9\u30ec\u30b9\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>\u30b3\u30f3\u30c6\u30ca\u5185\u304b\u3089\u306e\u540d\u524d\u89e3\u6c7a<\/h3>\n<pre class=\"lang:default decode:true\"># Debian \/ Ubuntu \u7cfb\u306e\u30a4\u30e1\u30fc\u30b8\ndocker compose exec app getent hosts db\n\n# Alpine \/ BusyBox \u7cfb\u306e\u30a4\u30e1\u30fc\u30b8\ndocker compose exec app nslookup db<\/pre>\n<h3>DNS \u306e\u53c2\u7167\u5148<\/h3>\n<pre class=\"lang:default decode:true\">docker compose exec app cat \/etc\/resolv.conf<\/pre>\n<p>\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u3044\u308c\u3070 <code>nameserver 127.0.0.11<\/code> \u304c\u51fa\u307e\u3059\u3002<\/p>\n<h3>\u8a3a\u65ad\u7528\u30b3\u30f3\u30c6\u30ca\u3092\u6a2a\u4ed8\u3051\u3059\u308b<\/h3>\n<pre class=\"lang:default decode:true\">docker run --rm -it --network &lt;\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u540d&gt;_default busybox:1.36 sh\n# \/ # nslookup db\n# \/ # wget -qO- http:\/\/app:3000\/health<\/pre>\n<h2>\u6ce8\u610f\u70b9<\/h2>\n<ul>\n<li><strong>IP \u30a2\u30c9\u30ec\u30b9\u3092\u6c7a\u3081\u6253\u3061\u3057\u306a\u3044<\/strong>: \u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u308a\u76f4\u3059\u3068 IP \u306f\u5909\u308f\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n<li><strong><code>container_name<\/code> \u306f\u5fc5\u9808\u3067\u306f\u306a\u3044<\/strong>: Compose \u306a\u3089\u30b5\u30fc\u30d3\u30b9\u540d\u3067\u5f15\u3051\u307e\u3059\u3002\u56fa\u5b9a\u3059\u308b\u3068 <code>--scale<\/code> \u304c\u4f7f\u3048\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/li>\n<li><strong><code>depends_on<\/code> \u306f\u8d77\u52d5\u9806\u3057\u304b\u4fdd\u8a3c\u3057\u306a\u3044<\/strong>: \u6e96\u5099\u5b8c\u4e86\u307e\u3067\u5f85\u3064\u306a\u3089 <code>healthcheck<\/code> \u3068 <code>condition: service_healthy<\/code> \u3092\u7d44\u307f\u5408\u308f\u305b\u307e\u3059\u3002\u30a2\u30d7\u30ea\u5074\u306b\u3082\u30ea\u30c8\u30e9\u30a4\u51e6\u7406\u3092\u5165\u308c\u3066\u304a\u304f\u3068\u5b89\u5fc3\u3067\u3059\u3002<\/li>\n<li><strong>\u30b3\u30f3\u30c6\u30ca\u304b\u3089\u30db\u30b9\u30c8\u3078\u306e\u30a2\u30af\u30bb\u30b9<\/strong>: Docker Desktop \u306a\u3089 <code>host.docker.internal<\/code> \u3067\u30db\u30b9\u30c8\u306b\u5c4a\u304d\u307e\u3059\u3002Linux \u306e\u5834\u5408\u306f\u6b21\u306e\u8a2d\u5b9a\u304c\u5fc5\u8981\u3067\u3059\u3002<\/li>\n<\/ul>\n<p>```yaml   extra_hosts:<\/p>\n<ul>\n<li>\"host.docker.internal:host-gateway\"<\/li>\n<\/ul>\n<p>```<\/p>\n<ul>\n<li><strong>\u30b9\u30b1\u30fc\u30eb\u6642\u306e\u540d\u524d\u89e3\u6c7a<\/strong>: <code>--scale app=3<\/code> \u306e\u3088\u3046\u306b\u8907\u6570\u8d77\u52d5\u3059\u308b\u3068\u3001\u30b5\u30fc\u30d3\u30b9\u540d\u306b\u8907\u6570\u306e IP \u304c\u8fd4\u308a\u307e\u3059\u3002\u8ca0\u8377\u5206\u6563\u304c\u5fc5\u8981\u306a\u3089\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u3092\u7f6e\u304f\u3053\u3068\u3092\u691c\u8a0e\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/li>\n<li><strong>Compose \u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u540d<\/strong>: \u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u540d\u306f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u540d\uff08\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\uff09\u304b\u3089\u4ed8\u3051\u3089\u308c\u307e\u3059\u3002\u5916\u304b\u3089\u53c2\u7167\u3059\u308b\u3068\u304d\u306f <code>docker network ls<\/code> \u3067\u5b9f\u969b\u306e\u540d\u524d\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<h2>\u307e\u3068\u3081<\/h2>\n<ul>\n<li>\u30b3\u30f3\u30c6\u30ca\u5185\u306e <code>localhost<\/code> \u306f\u305d\u306e\u30b3\u30f3\u30c6\u30ca\u81ea\u8eab<\/li>\n<li>\u30c7\u30d5\u30a9\u30eb\u30c8 bridge \u3067\u306f\u30b3\u30f3\u30c6\u30ca\u540d\u3067\u5f15\u3051\u306a\u3044\u306e\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u4f7f\u3046<\/li>\n<li>\u5185\u8535 DNS\uff08127.0.0.11\uff09\u304c\u30b3\u30f3\u30c6\u30ca\u540d\u30fb\u30b5\u30fc\u30d3\u30b9\u540d\u30fb\u30a8\u30a4\u30ea\u30a2\u30b9\u3092\u89e3\u6c7a\u3059\u308b<\/li>\n<li>Compose \u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u81ea\u52d5\u3067\u4f5c\u308b\u306e\u3067\u3001\u30b5\u30fc\u30d3\u30b9\u540d\u3067\u901a\u4fe1\u3067\u304d\u308b<\/li>\n<li>\u30b3\u30f3\u30c6\u30ca\u540c\u58eb\u306e\u901a\u4fe1\u3067\u306f\u30b3\u30f3\u30c6\u30ca\u5074\u306e\u30dd\u30fc\u30c8\u3092\u4f7f\u3046\u3002<code>ports<\/code> \u306f\u30db\u30b9\u30c8\u304b\u3089\u5165\u308b\u305f\u3081\u306e\u8a2d\u5b9a<\/li>\n<li>\u8d77\u52d5\u5f85\u3061\u306b\u306f <code>healthcheck<\/code> + <code>condition: service_healthy<\/code> \u3092\u4f7f\u3046<\/li>\n<\/ul>\n<p>\u300c\u540c\u3058\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u5165\u308c\u3066\u3001\u540d\u524d\u3067\u3001\u30b3\u30f3\u30c6\u30ca\u5074\u306e\u30dd\u30fc\u30c8\u306b\u7e4b\u3050\u300d\u3002\u3053\u306e 3 \u70b9\u3092\u62bc\u3055\u3048\u3066\u304a\u3051\u3070\u3001\u30b3\u30f3\u30c6\u30ca\u9593\u901a\u4fe1\u306e\u30c8\u30e9\u30d6\u30eb\u306e\u5927\u534a\u306f\u5207\u308a\u5206\u3051\u3089\u308c\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Docker \u3067 Web \u30b5\u30fc\u30d0\u30fc\u30fb\u30a2\u30d7\u30ea\u30fbDB \u3092\u5225\u3005\u306e\u30b3\u30f3\u30c6\u30ca\u306b\u5206\u3051\u305f\u3068\u304d\u3001\u591a\u304f\u306e\u4eba\u304c\u6700\u521d\u306b\u3064\u307e\u305a\u304f\u306e\u304c\u300c\u30b3\u30f3\u30c6\u30ca\u540c\u58eb\u304c\u7e4b\u304c\u3089\u306a\u3044\u300d\u554f\u984c\u3067\u3059\u3002\u539f\u56e0\u306f\u4e3b\u306b\u6b21\u306e 3 \u3064\u3067\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":3881,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","_lightning_design_setting":[],"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[75],"tags":[498,1162,359],"class_list":["post-3882","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code-of-serverside","tag-docker","tag-1162","tag-359"],"veu_head_title_object":{"title":"","add_site_title":""},"jetpack_publicize_connections":[],"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2026\/11\/20261116-plan092-thumbnail.jpg","_links":{"self":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3882","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/comments?post=3882"}],"version-history":[{"count":1,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3882\/revisions"}],"predecessor-version":[{"id":3888,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3882\/revisions\/3888"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media\/3881"}],"wp:attachment":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media?parent=3882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/categories?post=3882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/tags?post=3882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}