Docker : How to avoid Operation not permitted in Docker Container?

拈花ヽ惹草 提交于 2020-06-14 04:18:51

问题


I created one docker image of sles12 machine by taking backing of all file system which are necessary and created one tar file. For creating docker image I run following command -

cat fullbackup.tar | docker import - sles_image

After that I run docker image in container using below command -

docker run --net network1 -i -t sles_image /bin/bash

note - I already set up networking in this docker container (IP address which I want).

Now In my docker container, some applications are already configured because that applications are available in sles12 machine from which I created this docker image. These custom applications are internally running some kernel low level commands like modprobe.

But when I starts my application, application will start correctly. I'm facing this error -

Operation not permitted

How I can give correct permissions so that it will not give me this error?


回答1:


You might try set the Docker container with Runtime privilege and Linux capabilities, with the

docker run --privileged




回答2:


The Docker philosophy is: split your application into microservices and use a container for each microservice.

Docker container storage is not persistent. If you remove the container, your data will be lost. You need to use Docker volumes, or bind mounts to persist your data.

Now if you want to go againts all that, and put couple of services in a Docker container (not recommended), I recommend at least using a Dockerfile to create it from a base image. These base images, available in DockerHub (library) are optimized for containerized environments, and you can install and configure your services as you see fit in that image.



来源:https://stackoverflow.com/questions/41178553/docker-how-to-avoid-operation-not-permitted-in-docker-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!