问题 :无法停止泊坞窗容器,每当我尝试停止容器时,都会收到以下错误消息,
ERROR: for yattyadocker_web_1 cannot stop container: 1f04148910c5bac38983e6beb3f6da4c8be3f46ceeccdc8d7de0da9d2d76edd8: Cannot kill container 1f04148910c5bac38983e6beb3f6da4c8be3f46ceeccdc8d7de0da9d2d76edd8: rpc error: code = PermissionDenied desc = permission denied
操作系统版本/内部版本: Ubuntu 16.04 | Docker版本17.09.0-ce,构建afdb6d4 | Docker Compose版本1.17.1,内部版本6d101fb
重现步骤:
docker build -t <project name> .
docker-compose up --build
我试过的 :
sudo service docker restart
注意 :此配置以前可以正常工作,但是文件权限可能已更改,并且我看到此错误。我必须先跑步sudo service docker restart,然后才能将容器取出。但这非常不方便,我不知道如何解决此问题。
参考文件:
# docker-compose.yml version: '3' volumes: db-data: driver: local redis-data: driver: local services: db: image: postgres:9.4.1 volumes: - db-data:/var/lib/postgresql/data ports: - "5432:5432" env_file: local_envs.env web: image: yattya_docker:latest command: bundle exec puma -C config/puma.rb tty: true stdin_open: true ports: - "3000:3000" links: - db - redis - memcached depends_on: - db - redis - memcached env_file: local_envs.env redis: image: redis:3.2.4-alpine ports: # We'll bind our host's port 6379 to redis's port 6379, so we can use # Redis Desktop Manager (or other tools) with it: - 6379:6379 volumes: # We'll mount the 'redis-data' volume into the location redis stores it's data: - redis-data:/var/lib/redis command: redis-server --appendonly yes memcached: image: memcached:1.5-alpine ports: - "11211:11211" clock: image: yattya_docker:latest command: bundle exec clockwork lib/clock.rb links: - db depends_on: - db env_file: local_envs.env worker: image: yattya_docker:latest command: bundle exec rake jobs:work links: - db depends_on: - db env_file: local_envs.env
和Dockerfile:
# Dockerfile FROM ruby:2.4.1 RUN apt-get update && apt-get install -y nodejs --no-install-recommends && rm -rf /var/lib/apt/lists/* ENV APP_HOME /app RUN mkdir -p $APP_HOME WORKDIR $APP_HOME ADD Gemfile* $APP_HOME/ RUN bundle install ADD . $APP_HOME RUN mkdir -p ${APP_HOME}/log RUN cat /dev/null > "$APP_HOME/log/development.log" RUN mkdir -p ${APP_HOME}/tmp/cache \ && mkdir -p ${APP_HOME}/tmp/pids \ && mkdir -p ${APP_HOME}/tmp/sockets EXPOSE 3000
我能够解决此问题。由于某些未知问题,ubuntu中的Apparmor服务无法正常工作。该问题类似于moby项目https://github.com/moby/moby/issues/20554中报告的问题。
该/etc/apparmor.d/tunables文件夹为空,并且https://github.com/mlaventure建议 清除/重新安装apparmor以使其恢复到初始状态。
/etc/apparmor.d/tunables
因此,我重新安装了apparmor,并 在重新启动后 解决了该问题。
希望这可以帮助。