langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
49.68k stars 7.1k forks source link

When I used the new version 0.68 and the 0.20 sandbox, I still encountered workflow errors: error: operation not permitted #4576

Closed xiaoxiongxyy closed 3 months ago

xiaoxiongxyy commented 5 months ago

Self Checks

Dify version

0.68

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

image

simple code: def main(arg1): print(arg1)

✔️ Expected Behavior

no error

❌ Actual Behavior

panic

dosubot[bot] commented 5 months ago

Hello @xiaoxiongxyy! I'm Dosu, a bot here to help you squash bugs, answer questions, and guide you on becoming a contributor. While you wait for a human maintainer, I'm here to assist. I'll take a look at your issue and get back to you shortly!

xiaoxiongxyy commented 5 months ago

my test code: def main(arg1): print(arg1)

WillWillWong commented 5 months ago

def main(arg1): return {'result': str(arg1)} 你可以尝试一下这个代码

dosubot[bot] commented 5 months ago

To resolve the "error: operation not permitted" issue when using Dify version 0.68 in a self-hosted Docker environment, follow these steps:

  1. Check Docker and Docker Compose Versions: Ensure you have Docker 19.03 or later and Docker Compose 1.25.1 or later installed:

    docker --version
    docker-compose --version
  2. Set Proper Permissions: Ensure your user has the necessary permissions to run Docker commands:

    sudo usermod -aG docker $USER
  3. Clone Dify Repository: Clone the Dify source code to your local machine:

    git clone https://github.com/langgenius/dify.git
  4. Navigate to Docker Directory: Navigate to the docker directory in the Dify source code:

    cd dify/docker
  5. Review and Modify Docker Compose Configuration: Ensure the docker-compose.yaml file is correctly configured, especially the volume mounts and network settings:

    services:
     db:
       image: postgres:15-alpine
       volumes:
         - ./volumes/db/data:/var/lib/postgresql/data
     redis:
       image: redis:6-alpine
       volumes:
         - ./volumes/redis/data:/data
     sandbox:
       image: langgenius/dify-sandbox:0.2.0
       volumes:
         - ./volumes/sandbox/dependencies:/dependencies
  6. Start Dify: Start Dify using Docker Compose:

    docker compose up -d
  7. Check Container Status: Verify that all containers are running successfully:

    docker compose ps
  8. Review Docker Logs: Check the Docker container logs for any additional insights into the permission issue:

    docker logs <container_name>
  9. SELinux/AppArmor Policies: If SELinux or AppArmor is active, adjust the policies to allow the needed operations.

  10. Docker Security Options: Consider Docker's security options like --cap-add or --privileged to grant additional permissions, but use them cautiously:

    docker run --cap-add=SYS_ADMIN --security-opt seccomp=unconfined <image_name>

Ensure you have the necessary permissions and that your Docker setup meets the prerequisites as outlined in the documentation. If the issue persists, consult your system administrator or refer to Docker's documentation for further troubleshooting.

#### Details **Sources** - [Code block error: operation not permitted with dify-sandbox 0.2.0](https://github.com/langgenius/dify/issues/4344) - [Workflow run code tool error: operation not permitted](https://github.com/langgenius/dify/issues/3331) - [en/getting-started/install-self-hosted/docker-compose.md](https://github.com/langgenius/dify-docs/blob/main/en/getting-started/install-self-hosted/docker-compose.md) - [docker/docker-compose.middleware.yaml](https://github.com/langgenius/dify/blob/main/docker/docker-compose.middleware.yaml) - [docker/docker-compose.yaml](https://github.com/langgenius/dify/blob/main/docker/docker-compose.yaml)
**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

junonya commented 5 months ago

@xiaoxiongxyy It looks like you don't have enough permissions on the Dify server. Try changing the Dify server permissions using the chomod command.

crazywoola commented 3 months ago

See this https://github.com/langgenius/dify/issues/4993 for updates