AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Docker doesn't build?

Open stawiski opened this issue 1 year ago • 6 comments

Am I the only one for whom Docker doesn't build? 😮

Docker seems to build in CI on master branch, whereas I get:

Auto-GPT % docker build -t autogpt .
[+] Building 1.4s (9/15)
 => [internal] load build definition from Dockerfile                                                                                                                                                         0.0s
 => => transferring dockerfile: 74B                                                                                                                                                                          0.0s
 => [internal] load .dockerignore                                                                                                                                                                            0.0s
 => => transferring context: 2B                                                                                                                                                                              0.0s
 => [internal] load metadata for docker.io/library/python:3.11-slim                                                                                                                                          0.9s
 => [internal] load build context                                                                                                                                                                            0.0s
 => => transferring context: 114.84kB                                                                                                                                                                        0.0s
 => [ 1/11] FROM docker.io/library/python:3.11-slim@sha256:286f2f1d6f2f730a44108656afb04b131504b610a6cb2f3413918e98dabba67e                                                                                  0.0s
 => CACHED [ 2/11] RUN apt-get -y update                                                                                                                                                                     0.0s
 => CACHED [ 3/11] RUN apt-get -y install git chromium-driver                                                                                                                                                0.0s
 => CACHED [ 4/11] RUN apt-get update     && apt-get install -y wget gnupg2 libgtk-3-0 libdbus-glib-1-2 dbus-x11 xvfb ca-certificates                                                                        0.0s
 => ERROR [ 5/11] RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -     && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sour  0.3s
------
 > [ 5/11] RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -     && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list     && apt-get update     && apt-get install -y chromium firefox-esr:
#8 0.238 Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
#8 0.307 gpg: no valid OpenPGP data found.
------
executor failed running [/bin/sh -c wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -     && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list     && apt-get update     && apt-get install -y chromium firefox-esr]: exit code: 2

This in on MacOS Ventura 13.3.1

% docker --version
Docker version 20.10.17, build 100c701

It built after removing the gpg key lines to just:

# Install Firefox / Chromium
RUN apt-get install -y chromium firefox-esr

stawiski avatar Apr 22 '23 11:04 stawiski

Any format errors in the DockerFile ? I had got an error similar to this when I made some syntax error in the Dockerfile

bobinson avatar Apr 22 '23 12:04 bobinson

I just grabbed latest on stable branch.

stawiski avatar Apr 22 '23 12:04 stawiski

Summary: docker build working without errors on mac

  1. stable branch 91537b049625b6516f2b5f7361ae993d4e878a2e
  2. Docker version 20.10.23, build 7155243
  3. MacOS on M2 (Darwin MacBook-Pro.local 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 21:01:02 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T8112 arm64)

EDIT: there was an internet issue and a second attempt worked without errors

[06:42 PM] bobinson@MacBook-Pro 🖖  [~/src/Auto-GPT]docker build -t autogpt .
[+] Building 70.5s (16/16) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                      0.0s
 => => transferring dockerfile: 1.42kB                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                         0.0s
 => => transferring context: 2B                                                                                                                           0.0s
 => [internal] load metadata for docker.io/library/python:3.10-slim                                                                                       2.5s
 => [internal] load build context                                                                                                                         0.1s
 => => transferring context: 129.57kB                                                                                                                     0.0s
 => [ 1/11] FROM docker.io/library/python:3.10-slim@sha256:330173e29b1d14a58aecf60031d53fbda203886d5306c235d6a65e373ba172a0                               0.0s
 => CACHED [ 2/11] RUN apt-get -y update                                                                                                                  0.0s
 => CACHED [ 3/11] RUN apt-get -y install git chromium-driver                                                                                             0.0s
 => CACHED [ 4/11] RUN apt-get update     && apt-get install -y wget gnupg2 libgtk-3-0 libdbus-glib-1-2 dbus-x11 xvfb ca-certificates                     0.0s
 => CACHED [ 5/11] RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -     && echo "deb [arch=amd64] http://dl.google  0.0s
 => CACHED [ 6/11] RUN useradd --create-home appuser                                                                                                      0.0s
 => CACHED [ 7/11] WORKDIR /home/appuser                                                                                                                  0.0s
 => CACHED [ 8/11] RUN chown appuser:appuser /home/appuser                                                                                                0.0s
 => CACHED [ 9/11] COPY --chown=appuser:appuser requirements.txt .                                                                                        0.0s
 => [10/11] RUN sed -i '/Items below this point will not be included in the Docker Image/,$d' requirements.txt &&  pip install --no-cache-dir --user -r  66.5s
 => [11/11] COPY --chown=appuser:appuser autogpt/ ./autogpt                                                                                               0.2s
 => exporting to image                                                                                                                                    1.1s
 => => exporting layers                                                                                                                                   1.1s
 => => writing image sha256:d134937be21afa12289b6faa76d125d89dc11b74981b198d858635a05650ec52                                                              0.0s
 => => naming to docker.io/library/autogpt

bobinson avatar Apr 22 '23 12:04 bobinson

@bobinson you built it from cache. Try with --no-cache option to force it to rebuild.

stawiski avatar Apr 23 '23 01:04 stawiski

I ended up just replacing the doc function: @command("execute_python_file", "Execute Python File", '"filename": ""') def execute_python_file(filename: str) -> str:

if ".py" not in filename:
    return "You can only execute python files"
if ".py" in filename:
    cmd = f"python {filename}"  
    return execute_shell(cmd)   
    

Drlordbasil avatar Apr 23 '23 22:04 Drlordbasil

Hi @stawiski the no-cache option also worked for me ...



$ docker build -t autogpt . --no-cache
[+] Building 126.0s (16/16) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                      0.1s
 => => transferring dockerfile: 74B                                                                                                                       0.0s
 => [internal] load .dockerignore                                                                                                                         0.0s
 => => transferring context: 2B                                                                                                                           0.0s
 => [internal] load metadata for docker.io/library/python:3.10-slim                                                                                       2.6s
 => CACHED [ 1/11] FROM docker.io/library/python:3.10-slim@sha256:330173e29b1d14a58aecf60031d53fbda203886d5306c235d6a65e373ba172a0                        0.0s
 => [internal] load build context                                                                                                                         0.1s
 => => transferring context: 19.10kB                                                                                                                      0.1s
 => [ 2/11] RUN apt-get -y update                                                                                                                         4.5s
 => [ 3/11] RUN apt-get -y install git chromium-driver                                                                                                   55.4s
 => [ 4/11] RUN apt-get update     && apt-get install -y wget gnupg2 libgtk-3-0 libdbus-glib-1-2 dbus-x11 xvfb ca-certificates                            6.4s
 => [ 5/11] RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -     && echo "deb [arch=amd64] http://dl.google.com/l  16.3s
 => [ 6/11] RUN useradd --create-home appuser                                                                                                             0.3s
 => [ 7/11] WORKDIR /home/appuser                                                                                                                         0.0s
 => [ 8/11] RUN chown appuser:appuser /home/appuser                                                                                                       0.2s
 => [ 9/11] COPY --chown=appuser:appuser requirements.txt .                                                                                               0.0s
 => [10/11] RUN sed -i '/Items below this point will not be included in the Docker Image/,$d' requirements.txt &&  pip install --no-cache-dir --user -r  34.7s
 => [11/11] COPY --chown=appuser:appuser autogpt/ ./autogpt                                                                                               0.1s
 => exporting to image                                                                                                                                    5.4s
 => => exporting layers                                                                                                                                   5.4s
 => => writing image sha256:08df4d5136095263c42d4ed89ad8932aac9f939a5149996eecd8f15c70274beb                                                              0.0s
 => => naming to docker.io/library/autogpt

bobinson avatar Apr 24 '23 09:04 bobinson

I can see Dockerfile updated. Closing.

stawiski avatar Apr 26 '23 05:04 stawiski