Set secomp to unconfined in docker-compose

The compose syntax is correct. But the security_opt will be applied to the new instance of the container and thus is not available at build time like you are trying to do with the Dockerfile RUN command.

The correct way should be :

Dockerfile:

FROM golang:1.8
RUN go get -u github.com/derekparker/delve/cmd/dlv

docker-compose.yml

networks:
  backend:

services:
  example:
    build: .
    security_opt:
      - seccomp:unconfined
    networks:
      - backend
    ports:
      - "5002:5002"
    entrypoint: ['/usr/local/bin/dlv', '--listen=: 2345', '--headless=true', '--api-version=2', 'exec', 'cmd/main.go']

Leave a Comment