LoginSignup
2
0

More than 1 year has passed since last update.

docker-compose が stdout を拾ってくれない問題

Last updated at Posted at 2022-03-20

docker-compose でコンテナ起動した際に、dockerがコンテナ側の標準出力を拾ってくれなくなり困ったのでメモを残しておく。

現象

docker-compose up で起動した後、 Attaching to **** 以降のログが表示されなくなった。
コンテナは正常に稼働していたので、起動に失敗しているわけではないらしい。
使用環境はmac os(10.15.7)で、使用していたイメージは golang。

解決

Docker Desktop for Mac をダウングレードすることで解決した。
4.6.0 → 4.4.2

Dockerfileとdocker-compose.yml

おそらく今回の問題とは関係ないと思うけど。

Dockerfile
FROM golang:1.17.8-bullseye

ENV GOPATH /go
ENV GO111MODULE on

RUN mkdir /go/src/app
WORKDIR /go/src/app

ADD . /go/src/app

RUN go mod init v1
RUN go mod tidy
RUN go install github.com/cosmtrek/air@v1.29.0
docker-compose.yml
version: '3'
services:
  go:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - 8081:8080
    volumes:
      - ./app:/go/src/app:delegated
    tty: true
    stdin_open: true
    command: air -c .air.toml
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0