Tools: Handling Docker 'Operation not permitted' Error

Tools: Handling Docker 'Operation not permitted' Error

Overview

Solution

Thoughts

References While running tests in golang using Docker Compose, I encountered an Operation not permitted error. Docker Documentation - runtime-privilege-and-linux-capabilities Adjusting the privilege settings of the Docker container resolves the issue. Since I wasn't entirely sure about the security implications of the above, I configured it to restrict permissions further. cap_add is an option to add Linux capabilities, and here it adds permissions for system administration operations. Linux capabilities are a feature that subdivides superuser privileges. seccomp is a security feature that restricts system call issuance in the Linux kernel. Here, it is set to unconfined, which means disabled. Unconfined literally translates to "not confined." speakerdeck - Fully Understanding Containers I studied containers briefly before, but my understanding is still shallow. Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to ? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse

Code Block

Copy

gobel_test_db: container_name: "gobel_test_db" build: ./docker/mysql ports: - "3305:3306" volumes: - mysql_gobel_test_db:/var/lib/mysql:delegated - ./docker/mysql/initdb.d/gobel_test_db:/docker-entrypoint-initdb.d environment: - MYSQL_DATABASE=gobel_test - MYSQL_ROOT_PASSWORD=password privileged: true // add this option gobel_test_db: container_name: "gobel_test_db" build: ./docker/mysql ports: - "3305:3306" volumes: - mysql_gobel_test_db:/var/lib/mysql:delegated - ./docker/mysql/initdb.d/gobel_test_db:/docker-entrypoint-initdb.d environment: - MYSQL_DATABASE=gobel_test - MYSQL_ROOT_PASSWORD=password privileged: true // add this option gobel_test_db: container_name: "gobel_test_db" build: ./docker/mysql ports: - "3305:3306" volumes: - mysql_gobel_test_db:/var/lib/mysql:delegated - ./docker/mysql/initdb.d/gobel_test_db:/docker-entrypoint-initdb.d environment: - MYSQL_DATABASE=gobel_test - MYSQL_ROOT_PASSWORD=password privileged: true // add this option gobel_test_db: container_name: "gobel_test_db" build: ./docker/mysql ports: - "3305:3306" volumes: - mysql_gobel_test_db:/var/lib/mysql:delegated - ./docker/mysql/initdb.d/gobel_test_db:/docker-entrypoint-initdb.d environment: - MYSQL_DATABASE=gobel_test - MYSQL_ROOT_PASSWORD=password cap_add: - SYS_ADMIN security_opt: - seccomp:unconfined gobel_test_db: container_name: "gobel_test_db" build: ./docker/mysql ports: - "3305:3306" volumes: - mysql_gobel_test_db:/var/lib/mysql:delegated - ./docker/mysql/initdb.d/gobel_test_db:/docker-entrypoint-initdb.d environment: - MYSQL_DATABASE=gobel_test - MYSQL_ROOT_PASSWORD=password cap_add: - SYS_ADMIN security_opt: - seccomp:unconfined gobel_test_db: container_name: "gobel_test_db" build: ./docker/mysql ports: - "3305:3306" volumes: - mysql_gobel_test_db:/var/lib/mysql:delegated - ./docker/mysql/initdb.d/gobel_test_db:/docker-entrypoint-initdb.d environment: - MYSQL_DATABASE=gobel_test - MYSQL_ROOT_PASSWORD=password cap_add: - SYS_ADMIN security_opt: - seccomp:unconfined - Qiita - systemd in docker container without --privileged