danielmiessler / fabric

fabric is an open-source framework for augmenting humans using AI. It provides a modular framework for solving specific problems using a crowdsourced set of AI prompts that can be used anywhere.
https://danielmiessler.com/p/fabric-origin-story
MIT License
25.13k stars 2.66k forks source link

[Bug]: Unable to Install Fabric Into Docker Container #809

Closed nathan-hook closed 2 months ago

nathan-hook commented 2 months ago

What happened?

I have tried to install Fabric into a Docker container, but run into an error when running the fabric --setup command.

Here is the contents of my very simple Dockerfile-fabric file:

FROM golang:1.23.0

#RUN go install github.com/danielmiessler/fabric@1.4.0
#RUN fabric --setup

To build and run the container, I ran the following commands:

$ docker build -t fabric -f Dockerfile-fabric .
$ docker container run -it fabric bash

I then run the go based install command and get the following output:

root@ce57063a97ca:/go# go install github.com/danielmiessler/fabric@2.0
go: downloading github.com/danielmiessler/fabric v1.4.1-0.20240816203922-b01bedb54a42
go: downloading github.com/jessevdk/go-flags v1.6.1
go: downloading github.com/atotto/clipboard v0.1.4
go: downloading github.com/go-git/go-git/v5 v5.12.0
go: downloading github.com/otiai10/copy v1.14.0
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/joho/godotenv v1.5.1
go: downloading github.com/samber/lo v1.47.0
go: downloading github.com/liushuangls/go-anthropic/v2 v2.6.0
go: downloading github.com/sashabaranov/go-openai v1.28.2
go: downloading github.com/google/generative-ai-go v0.17.0
go: downloading google.golang.org/api v0.192.0
go: downloading github.com/ollama/ollama v0.3.6
go: downloading golang.org/x/sys v0.24.0
go: downloading golang.org/x/sync v0.8.0
go: downloading dario.cat/mergo v1.0.0
go: downloading github.com/ProtonMail/go-crypto v1.0.0
go: downloading github.com/go-git/go-billy/v5 v5.5.0
go: downloading github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3
go: downloading github.com/emirpasic/gods v1.18.1
go: downloading golang.org/x/text v0.16.0
go: downloading cloud.google.com/go/ai v0.8.0
go: downloading cloud.google.com/go v0.115.0
go: downloading github.com/googleapis/gax-go/v2 v2.13.0
go: downloading google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf
go: downloading google.golang.org/grpc v1.64.1
go: downloading google.golang.org/protobuf v1.34.2
go: downloading golang.org/x/crypto v0.25.0
go: downloading github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376
go: downloading github.com/pjbgf/sha1cd v0.3.0
go: downloading github.com/cyphar/filepath-securejoin v0.2.4
go: downloading github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99
go: downloading cloud.google.com/go/longrunning v0.5.7
go: downloading google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d
go: downloading github.com/cloudflare/circl v1.3.7
go: downloading gopkg.in/warnings.v0 v0.1.2
go: downloading github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
go: downloading github.com/kevinburke/ssh_config v1.2.0
go: downloading github.com/skeema/knownhosts v1.2.2
go: downloading github.com/xanzy/ssh-agent v0.3.3
go: downloading golang.org/x/net v0.27.0
go: downloading cloud.google.com/go/auth v0.8.1
go: downloading golang.org/x/oauth2 v0.22.0
go: downloading cloud.google.com/go/auth/oauth2adapt v0.2.3
go: downloading cloud.google.com/go/compute/metadata v0.5.0
go: downloading go.opencensus.io v0.24.0
go: downloading go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.51.0
go: downloading golang.org/x/time v0.6.0
go: downloading go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0
go: downloading github.com/google/uuid v1.6.0
go: downloading github.com/google/s2a-go v0.1.8
go: downloading go.opentelemetry.io/otel v1.26.0
go: downloading go.opentelemetry.io/otel/metric v1.26.0
go: downloading go.opentelemetry.io/otel/trace v1.26.0
go: downloading github.com/googleapis/enterprise-certificate-proxy v0.3.2
go: downloading github.com/felixge/httpsnoop v1.0.4
go: downloading github.com/go-logr/logr v1.4.2
go: downloading github.com/go-logr/stdr v1.2.2

The problem occurs when running the fabric --setup command:

root@ce57063a97ca:/go# fabric --setup

[Anthropic]

Enter your Anthropic API KEY (leave empty to skip):

[Anthropic] skiped

[OpenAI]

Enter your OpenAI API KEY (leave empty to skip):

[OpenAI] skiped

[Azure]

Enter your Azure API KEY (leave empty to skip):

[Azure] skiped

[Ollama]

Enter your Ollama URL (as a reminder, it is usually http://localhost:11434) (leave empty to skip):
http://ollama:11434
[Ollama] configured

[Grocq]

Enter your Grocq API KEY (leave empty to skip):

[Grocq] skiped

[Gemini]

Enter your Gemini API KEY (leave empty to skip):

[Gemini] skiped
Get "http://ollama:11434/api/tags": dial tcp: lookup ollama on 192.168.65.7:53: no such host

Available vendor models:

[Default]

Enter the index the name of your default model (leave empty to skip):

DEFAULT_MODEL=, is not valid

When asked for the "default model" I have tried numerous values and/or leaving the value empty to skip, but I either get the "DEFAULT_MODEL=, is not valid" error message or I get a "You need to chose an available default model."

Here are a few of the default models I have tried: llama3:latest llama3 llama3:8b llama2:latest llama2

Any friendly direction letting me know what I have done wrong would be greatly appreciated.

FWIW, here is my docker-compose file that is used to start both Ollama and open-webui:

services:
  ollama:
    volumes:
      - ollama:/root/.ollama
    container_name: ollama
    pull_policy: always
    tty: true
    restart: unless-stopped
#    image: ollama/ollama:${OLLAMA_DOCKER_TAG-latest}
    image: ollama/ollama:latest

  open-webui:
    build:
      context: .
      args:
        OLLAMA_BASE_URL: '/ollama'
      dockerfile: Dockerfile
#    image: ghcr.io/open-webui/open-webui:${WEBUI_DOCKER_TAG-main}
    image: ghcr.io/open-webui/open-webui:latest
    container_name: open-webui
    volumes:
      - open-webui:/app/backend/data
    depends_on:
      - ollama
    ports:
#      - ${OPEN_WEBUI_PORT-3000}:8080
      - 3000:8080
    environment:
      - 'OLLAMA_BASE_URL=http://ollama:11434'
#      - 'WEBUI_SECRET_KEY='
    extra_hosts:
      - host.docker.internal:host-gateway
    restart: unless-stopped

volumes:
  ollama: {}
  open-webui: {}

Version check

Relevant log output

No response

Relevant screenshots (optional)

No response

nathan-hook commented 2 months ago

Please ignore, the problem existed between the keyboard and chair. I messed up my networking inside of my docker containers.

Once I ran my docker container like the following:

$ docker container run --network ollama_default -it fabric bash

Everything ran just fine...

root@ef42e3d4c199:/go# go install github.com/danielmiessler/fabric@2.0
go: downloading github.com/danielmiessler/fabric v1.4.1-0.20240816203922-b01bedb54a42
go: downloading github.com/jessevdk/go-flags v1.6.1
go: downloading github.com/atotto/clipboard v0.1.4
go: downloading github.com/go-git/go-git/v5 v5.12.0
go: downloading github.com/otiai10/copy v1.14.0
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/joho/godotenv v1.5.1
go: downloading github.com/samber/lo v1.47.0
go: downloading github.com/liushuangls/go-anthropic/v2 v2.6.0
go: downloading github.com/sashabaranov/go-openai v1.28.2
go: downloading github.com/google/generative-ai-go v0.17.0
go: downloading google.golang.org/api v0.192.0
go: downloading github.com/ollama/ollama v0.3.6
go: downloading golang.org/x/sys v0.24.0
go: downloading golang.org/x/sync v0.8.0
go: downloading dario.cat/mergo v1.0.0
go: downloading github.com/ProtonMail/go-crypto v1.0.0
go: downloading github.com/go-git/go-billy/v5 v5.5.0
go: downloading github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3
go: downloading github.com/emirpasic/gods v1.18.1
go: downloading golang.org/x/text v0.16.0
go: downloading github.com/cyphar/filepath-securejoin v0.2.4
go: downloading github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376
go: downloading github.com/pjbgf/sha1cd v0.3.0
go: downloading github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99
go: downloading cloud.google.com/go/ai v0.8.0
go: downloading cloud.google.com/go v0.115.0
go: downloading github.com/googleapis/gax-go/v2 v2.13.0
go: downloading google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf
go: downloading google.golang.org/grpc v1.64.1
go: downloading google.golang.org/protobuf v1.34.2
go: downloading golang.org/x/crypto v0.25.0
go: downloading gopkg.in/warnings.v0 v0.1.2
go: downloading github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
go: downloading github.com/kevinburke/ssh_config v1.2.0
go: downloading github.com/skeema/knownhosts v1.2.2
go: downloading github.com/xanzy/ssh-agent v0.3.3
go: downloading golang.org/x/net v0.27.0
go: downloading cloud.google.com/go/longrunning v0.5.7
go: downloading google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d
go: downloading github.com/cloudflare/circl v1.3.7
go: downloading github.com/google/uuid v1.6.0
go: downloading cloud.google.com/go/auth v0.8.1
go: downloading cloud.google.com/go/auth/oauth2adapt v0.2.3
go: downloading go.opencensus.io v0.24.0
go: downloading go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0
go: downloading golang.org/x/oauth2 v0.22.0
go: downloading cloud.google.com/go/compute/metadata v0.5.0
go: downloading go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.51.0
go: downloading golang.org/x/time v0.6.0
go: downloading github.com/felixge/httpsnoop v1.0.4
go: downloading go.opentelemetry.io/otel v1.26.0
go: downloading go.opentelemetry.io/otel/metric v1.26.0
go: downloading go.opentelemetry.io/otel/trace v1.26.0
go: downloading github.com/google/s2a-go v0.1.8
go: downloading github.com/googleapis/enterprise-certificate-proxy v0.3.2
go: downloading github.com/go-logr/logr v1.4.2
go: downloading github.com/go-logr/stdr v1.2.2
root@ef42e3d4c199:/go# fabric --setup

[Grocq]

Enter your Grocq API KEY (leave empty to skip):

[Grocq] skiped

[Gemini]

Enter your Gemini API KEY (leave empty to skip):

[Gemini] skiped

[Anthropic]

Enter your Anthropic API KEY (leave empty to skip):

[Anthropic] skiped

[OpenAI]

Enter your OpenAI API KEY (leave empty to skip):

[OpenAI] skiped

[Azure]

Enter your Azure API KEY (leave empty to skip):

[Azure] skiped

[Ollama]

Enter your Ollama URL (as a reminder, it is usually http://localhost:11434) (leave empty to skip):
http://ollama:11434
[Ollama] configured

Available vendor models:

Ollama

    [1] llama3.1:latest

[Default]

Enter the index the name of your default model (leave empty to skip):
llama3.1:latest

DEFAULT_VENDOR: Ollama
DEFAULT_MODEL: llama3.1:latest

[Patterns Loader]

Enter the default Git repository URL for the patterns (leave empty for 'https://github.com/danielmiessler/fabric.git' or type 'reset' to remove the value):

Enter the default folder in the Git repository where patterns are stored (leave empty for 'patterns' or type 'reset' to remove the value):

Downloading patterns and Populating /root/.config/fabric/patterns..

Sorry for any inconvenience caused.

fahadshery commented 2 months ago

What happened?

I have tried to install Fabric into a Docker container, but run into an error when running the fabric --setup command.

Here is the contents of my very simple Dockerfile-fabric file:

FROM golang:1.23.0

#RUN go install github.com/danielmiessler/fabric@1.4.0
#RUN fabric --setup

To build and run the container, I ran the following commands:

$ docker build -t fabric -f Dockerfile-fabric .
$ docker container run -it fabric bash

The problem occurs when running the fabric --setup command:

Get "http://ollama:11434/api/tags": dial tcp: lookup ollama on 192.168.65.7:53: no such host

Available vendor models:

[Default]

Enter the index the name of your default model (leave empty to skip):

DEFAULT_MODEL=, is not valid



When asked for the "default model" I have tried numerous values and/or leaving the value empty to skip, but I either get the "DEFAULT_MODEL=, is not valid" error message or I get a "You need to chose an available default model."

Hi Nathan,

Here is my DockerFile:

FROM golang:1.22.5-alpine3.20

# Install required packages
RUN apk add --no-cache git ffmpeg util-linux sudo bash

# Create a non-root user
RUN adduser -D appuser && echo "appuser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/appuser \
    && chmod 0440 /etc/sudoers.d/appuser

# Use a least privileged user
USER appuser

# Install fabric with go install command
RUN go install github.com/danielmiessler/fabric@latest

# Set the entrypoint to run the fabric command directly
ENTRYPOINT ["/bin/bash", "-c", "fabric"]

Here is my .env:

DEFAULT_MODEL=llama3.1
OLLAMA_API_URL=http://ollama:11434
OPENAI_API_KEY=NULL

GEMINI_API_KEY=
GROQ_API_KEY=
ANTHROPIC_API_KEY=
OPENAI_API_KEY=
YOUTUBE_API_KEY=my key
PATTERNS_LOADER_GIT_REPO_URL=https://github.com/danielmiessler/fabric.git
PATTERNS_LOADER_GIT_REPO_PATTERNS_FOLDER=patterns

I try running the container like:

docker container run -it -v /home/user/ai-stack/fabric/:/home/appuser/.config/fabric --network traefik 6412e596197f

I am getting the following:

no session, pattern or user messages provided

how are you passing user messages or patterns when running the container?

nathan-hook commented 2 months ago

I am getting the following:

no session, pattern or user messages provided

how are you passing user messages or patterns when running the container?

Generally speaking, that is the output of fabric when the fabric command is run without any parameters.

A fabric command should look like the following:

$ cat brown-fox.txt | fabric --stream --pattern extract_wisdom

Where cat <FILE_NAME> is used to pipe information into the | fabric --stream --pattern extract_wisdom command.

I'm sure that you could figure out how to properly add the --stream and --pattern to your Dockerfile's ENTRYPOINT, but I do believe that streaming the file in might be a bit difficult.

I would suggest not trying to run the docker container all in one shot, but use it to build an interactive container that works as a command line interface.

Here is an example setup that I have been testing...

Docker-compose file for setting up Ollama and Open WebUI:

services:
  ollama:
    volumes:
      - ollama:/root/.ollama
    container_name: ollama
    pull_policy: always
    tty: true
    restart: unless-stopped
#    image: ollama/ollama:${OLLAMA_DOCKER_TAG-latest}
    image: ollama/ollama:latest

  open-webui:
    build:
      context: .
      args:
        OLLAMA_BASE_URL: '/ollama'
      dockerfile: Dockerfile
#    image: ghcr.io/open-webui/open-webui:${WEBUI_DOCKER_TAG-main}
    image: ghcr.io/open-webui/open-webui:latest
    container_name: open-webui
    volumes:
      - open-webui:/app/backend/data
    depends_on:
      - ollama
    ports:
#      - ${OPEN_WEBUI_PORT-3000}:8080
      - 3000:8080
    environment:
      - 'OLLAMA_BASE_URL=http://ollama:11434'
#      - 'WEBUI_SECRET_KEY='
    extra_hosts:
      - host.docker.internal:host-gateway
    restart: unless-stopped

volumes:
  ollama: {}
  open-webui: {}

To run the Ollama and Open WebUI containers:

$ docker-compose -f docker-compose.yml up -d

Then here is a Docker file for fabric, Dockerfile-fabric:

FROM golang:1.23.0

COPY ./brown-fox.txt /go/brown-fox.txt
COPY ./.env /root/.config/fabric/.env
#RUN go install github.com/danielmiessler/fabric@latest
#RUN fabric --setup

I actually, mostly, used the example .env file that you provided in your example, but I changed it a bit:

DEFAULT_VENDOR=Ollama
DEFAULT_MODEL=llama3.1
OLLAMA_API_URL=http://ollama:11434
OPENAI_API_KEY=NULL
GEMINI_API_KEY=
GROQ_API_KEY=
ANTHROPIC_API_KEY=
OPENAI_API_KEY=
YOUTUBE_API_KEY=my key

Then the contents of brown-fox.txt:

The quick brown fox jumped over the lazy dog.

To build and run the Fabric docker container:

$ docker build -t fabric -f Dockerfile-fabric .
$ docker container run --network ollama_default --rm -it fabric bash

I am still running several commands by hand inside of the docker container because I am just futzing with Fabric and trying to figure out how to build a container around it and run it for my particular use cases...

So, inside the container I run the following commands:

# go install github.com/danielmiessler/fabric@latest
# fabric --setup

Even though the .env file has many of the correct environment variables, the setup file actually clones the fabric github repository and then moves the patterns into the /root/.config/fabric/patterns directory.

Then you should be able to test Fabric:

# cat brown-fox.txt | fabric --stream --pattern extract_wisdom

However, I get a timeout issue that I believe is associated with this bug:

824

I hope that helps.

fahadshery commented 2 months ago

I hope that helps.

Thank you for the detailed answer. I just got started with fabric. I even created a PR where I provided docker files etc. All working fine. Please review and feedback if required.

Cheers

nathan-hook commented 2 months ago

FWIW, I believe that we can avoid having to run the fabric --setup command when using a .env file.

I have gotten to the same place as my previous post, but without having to run any of the setup manually.

Here is the new Dockerfile-fabric contents:

FROM golang:1.23.0

COPY ./brown-fox.txt /go/brown-fox.txt
COPY ./.env /root/.config/fabric/.env
RUN go install github.com/danielmiessler/fabric@latest
RUN fabric --updatepatterns

The above image will install Fabric and then install the patterns, which also happens at the final step of the fabric --setup command.

Here is the .env file contents:

DEFAULT_VENDOR=Ollama
DEFAULT_MODEL=llama3.1
OLLAMA_API_URL=http://ollama:11434
GEMINI_API_KEY=
GROQ_API_KEY=
ANTHROPIC_API_KEY=
OPENAI_API_KEY=
YOUTUBE_API_KEY=my key
PATTERNS_LOADER_GIT_REPO_URL=https://github.com/danielmiessler/fabric.git
PATTERNS_LOADER_GIT_REPO_PATTERNS_FOLDER=patterns

To build and then run the image:

$ docker build -t fabric -f Dockerfile-fabric .
$ docker container run --network ollama_default --rm -it fabric bash

Finally inside the container's command line, you can run the fabric command:

root@dd9c75fe92a5:/go# cat brown-fox.txt | fabric --stream --pattern extract_wisdom
Post "http://ollama:11434/api/chat": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
nathan-hook commented 2 months ago

Please review and feedback if required.

Nice PR.

There are two little things that I noticed:

Other than that, I think everything looks good. From my perspective, good job. :)

brauliodiasribeiro commented 2 months ago

someone help me install Fabric AI in a docker on Unraid? I don't know how to build this docker in Unraid because it asks for the image path.

brauliodiasribeiro commented 1 month ago

FWIW, I believe that we can avoid having to run the fabric --setup command when using a .env file.

I have gotten to the same place as my previous post, but without having to run any of the setup manually.

Here is the new Dockerfile-fabric contents:

FROM golang:1.23.0

COPY ./brown-fox.txt /go/brown-fox.txt
COPY ./.env /root/.config/fabric/.env
RUN go install github.com/danielmiessler/fabric@latest
RUN fabric --updatepatterns

The above image will install Fabric and then install the patterns, which also happens at the final step of the fabric --setup command.

Here is the .env file contents:

DEFAULT_VENDOR=Ollama
DEFAULT_MODEL=llama3.1
OLLAMA_API_URL=http://ollama:11434
GEMINI_API_KEY=
GROQ_API_KEY=
ANTHROPIC_API_KEY=
OPENAI_API_KEY=
YOUTUBE_API_KEY=my key
PATTERNS_LOADER_GIT_REPO_URL=https://github.com/danielmiessler/fabric.git
PATTERNS_LOADER_GIT_REPO_PATTERNS_FOLDER=patterns

To build and then run the image:

$ docker build -t fabric -f Dockerfile-fabric .
$ docker container run --network ollama_default --rm -it fabric bash

Finally inside the container's command line, you can run the fabric command:

root@dd9c75fe92a5:/go# cat brown-fox.txt | fabric --stream --pattern extract_wisdom
Post "http://ollama:11434/api/chat": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

Can you help install this docker?

This is my error:

unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/bdrtec/Fabric/Dockerfile-fabric: no such file or directory Unable to find image 'fabric:latest' locally docker: Error response from daemon: pull access denied for fabric, repository does not exist or may require 'docker login': denied: requested access to the resource is denied. See 'docker run --help'. bdrtec@UbuntuServer:~/Fabric$

nathan-hook commented 1 month ago

Can you help install this docker?

This is my error:

unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/bdrtec/Fabric/Dockerfile-fabric: no such file or directory Unable to find image 'fabric:latest' locally docker: Error response from daemon: pull access denied for fabric, repository does not exist or may require 'docker login': denied: requested access to the resource is denied. See 'docker run --help'. bdrtec@UbuntuServer:~/Fabric$

I can try.

Please do a ls -al on your /home/bdrtec/Fabric/ directory and show us the output please.

And then please show us which directory you're running your commands in, the exact commands you're running and what each commands output is.

That will allow for easier debugging.

brauliodiasribeiro commented 1 month ago

Can you help install this docker? This is my error: unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/bdrtec/Fabric/Dockerfile-fabric: no such file or directory Unable to find image 'fabric:latest' locally docker: Error response from daemon: pull access denied for fabric, repository does not exist or may require 'docker login': denied: requested access to the resource is denied. See 'docker run --help'. bdrtec@UbuntuServer:~/Fabric$

I can try.

Please do a ls -al on your /home/bdrtec/Fabric/ directory and show us the output please.

And then please show us which directory you're running your commands in, the exact commands you're running and what each commands output is.

That will allow for easier debugging.

Thank you first of all for your attention. I don't have much knowledge in this area, but I have an idea.

"ls -al on your /home/bdrtec/Fabric/" 01

"which directory you're running your commands in" Running here "/home/bdrtec/Fabric/" 03 ](url)

02

nathan-hook commented 1 month ago

Thank you for the images, they are helpful.

There is a lot going on here and I will try my best to break things down.

First image of your directory structure...

FWIW, this is actually the last problem that needs to be taken care of, but it doesn't look like you have a Dockerfile or a docker-compose file for running Ollama or OpenWebUI. Please see the comments above on how to use a docker-compose file to start both those containers. That docker-compose file will also create the ollama_default network that is referenced in your last command, but isn't found. The network is created based on the services: ollama: value at the beginning of the compose file.

Second image...

It doesn't look like docker was installed properly.

Please see this github issue for an explanation of the error you're seeing: While doing the docker build i am facing error saying DEPRECATED: The legacy builder is deprecated and will be removed in a future release. Install the buildx component to build images with BuildKit: #2297

More or less, the answer is, docker wasn't installed correctly.

Please consider uninstalling docker and then following the Install Docker Engine documentation.

I would also suggest following the Linux post-installation steps for Docker Engine documentation to help remove the need to use the sudo command.

Finally, the command run in the second image (but was corrected in the third image) isn't quite right. The command should be:

sudo docker build -t fabric -f Dockerfile-fabric .

The dot at the end of the command is important. It more or less states, we're running the docker build command in this directory's context. (I think... I could be wrong on that particular statement and with this being on the internet, someone will correct me if I'm wrong on that statement.)

Third Image...

I am unsure of how you got into this state, it seems as though you were able to run two commands at once without proper linux syntax, but I will try and ignore that.

The first error is the same as in the second image, it seems as though docker wasn't properly installed.

The unable to prepare context:... could be because the command is being run as root, and perhaps for some reason root doesn't have access to your home directory. If you have to run as root, try moving your fabric directory out of your home directory or just sudo su to root and use root's home directory for this work. FWIW, that is terrible advice, but I would be a hypocrite to tell you not to do that because I've, er, well done worse. :)

The Unable to find image... error is because the image was never created and if you do an docker image ls command you won't see the image listed. The rest of the error is just noise, please try to ignore it.

Hope that helps and good luck.

brauliodiasribeiro commented 1 month ago

Thank you for the images, they are helpful.

There is a lot going on here and I will try my best to break things down.

First image of your directory structure...

FWIW, this is actually the last problem that needs to be taken care of, but it doesn't look like you have a Dockerfile or a docker-compose file for running Ollama or OpenWebUI. Please see the comments above on how to use a docker-compose file to start both those containers. That docker-compose file will also create the ollama_default network that is referenced in your last command, but isn't found. The network is created based on the services: ollama: value at the beginning of the compose file.

Second image...

It doesn't look like docker was installed properly.

Please see this github issue for an explanation of the error you're seeing: While doing the docker build i am facing error saying DEPRECATED: The legacy builder is deprecated and will be removed in a future release. Install the buildx component to build images with BuildKit: #2297

More or less, the answer is, docker wasn't installed correctly.

Please consider uninstalling docker and then following the Install Docker Engine documentation.

I would also suggest following the Linux post-installation steps for Docker Engine documentation to help remove the need to use the sudo command.

Finally, the command run in the second image (but was corrected in the third image) isn't quite right. The command should be:

sudo docker build -t fabric -f Dockerfile-fabric .

The dot at the end of the command is important. It more or less states, we're running the docker build command in this directory's context. (I think... I could be wrong on that particular statement and with this being on the internet, someone will correct me if I'm wrong on that statement.)

Third Image...

I am unsure of how you got into this state, it seems as though you were able to run two commands at once without proper linux syntax, but I will try and ignore that.

The first error is the same as in the second image, it seems as though docker wasn't properly installed.

The unable to prepare context:... could be because the command is being run as root, and perhaps for some reason root doesn't have access to your home directory. If you have to run as root, try moving your fabric directory out of your home directory or just sudo su to root and use root's home directory for this work. FWIW, that is terrible advice, but I would be a hypocrite to tell you not to do that because I've, er, well done worse. :)

The Unable to find image... error is because the image was never created and if you do an docker image ls command you won't see the image listed. The rest of the error is just noise, please try to ignore it.

Hope that helps and good luck.

Thank you very much for your time and knowledge. I'll try to resolve these things this week and come back here to leave a comment.

First image of your directory structure... I have ollama in a container on Unraid. I'll see if I can link it here. If I can't, I'll install it again on linux to test it.

Second image... A lot of information here. I need to learn a lot of things (laughs). I'll do this and get back to you.

Third Image... I'm going to analyze all of this.

brauliodiasribeiro commented 1 month ago

I need create this folder and files or is automatically? "/go/brown-fox.txt" and "/root/.config/fabric/.env"

“/go/brown-fox.txt” will this folder be inside my current folder?

COPY ./brown-fox.txt /go/brown-fox.txt COPY ./.env /root/.config/fabric/.env

av commented 1 month ago

JFYI, fabric does things with TTY that are not very docker-friendly, your ENTRYPOINT should look like this to pipe correctly:

ENTRYPOINT [ "fabric" ]

Just for reference, sample Dockerfile: https://github.com/av/harbor/blob/main/fabric/Dockerfile The way to invoke it without breaking TTY: https://github.com/av/harbor/blob/main/harbor.sh#L2546

brauliodiasribeiro commented 1 month ago

JFYI, fabric does things with TTY that are not very docker-friendly, your ENTRYPOINT should look like this to pipe correctly:

ENTRYPOINT [ "fabric" ]

Just for reference, sample Dockerfile: https://github.com/av/harbor/blob/main/fabric/Dockerfile The way to invoke it without breaking TTY: https://github.com/av/harbor/blob/main/harbor.sh#L2546

What’s TTY?