Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

error with line endings when generating Dockerfile on windows systems #185

Open
plaban1981 opened this issue Aug 1, 2022 · 22 comments
Open
Labels
bug Something isn't working

Comments

@plaban1981
Copy link

plaban1981 commented Aug 1, 2022

Describe the bug
resources that explain more about this bug

I encounter the below error when trying to build the model image using bentoctl build . Can you please help me.
Command tried :
$ bentoctl build -b cancer_classifier:apmmnnyq22egxjcc -f ./deployment_config.yaml

Error Encountered

**_error: failed to solve: executor failed running [/bin/bash -eo pipefail -c bash <<EOF**
**set -euxo pipefail**

**if [ -f /home/bentoml/bento/env/python/install.sh ]; then**
  **echo "install.sh to install python packages..."**
  **chmod +x /home/bentoml/bento/env/python/install.sh**
  **/home/bentoml/bento/env/python/install.sh**
**fi**
**EOF]: exit code: 2**
Traceback (most recent call last):
  File "C:\Users\nayak\anaconda3\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\nayak\anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\nayak\anaconda3\Scripts\bentoctl.exe\__main__.py", line 7, in <module>
    sys.exit(bentoctl())
  File "C:\Users\nayak\AppData\Roaming\Python\Python39\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\nayak\AppData\Roaming\Python\Python39\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Users\nayak\AppData\Roaming\Python\Python39\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\nayak\AppData\Roaming\Python\Python39\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\nayak\AppData\Roaming\Python\Python39\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\nayak\anaconda3\lib\site-packages\bentoctl\cli\utils.py", line 90, in wrapper
    return_value = func(*args, **kwargs)
  File "C:\Users\nayak\anaconda3\lib\site-packages\bentoctl\cli\utils.py", line 55, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\nayak\anaconda3\lib\site-packages\bentoctl\cli\utils.py", line 24, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\nayak\anaconda3\lib\site-packages\bentoctl\cli\__init__.py", line 147, in build
    generate_deployable_container(
  File "C:\Users\nayak\anaconda3\lib\site-packages\bentoctl\docker_utils.py", line 99, in generate_deployable_container
    buildx.build(**buildx_args)
  File "C:\Users\nayak\anaconda3\lib\site-packages\bentoml\_internal\utils\buildx.py", line 301, in build
    run_docker_cmd(cmds, env=subprocess_env, cwd=cwd)
  File "C:\Users\nayak\anaconda3\lib\site-packages\bentoml\_internal\utils\buildx.py", line 314, in run_docker_cmd
    subprocess.check_output(list(map(str, cmds)), env=subprocess_env, cwd=cwd)
  File "C:\Users\nayak\anaconda3\lib\subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "C:\Users\nayak\anaconda3\lib\subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['docker', 'buildx', 'build', '--progress', 'auto', '--tag', 'aws-lambda-cancer_classifier:apmmnnyq22egxjcc', '--platform', 'linux/amd64', '--file', 'env/docker/Dockerfile', '.']' returned non-zero exit status 1.
nayak (master *) BentoML_

To Reproduce
Steps to reproduce the issue:

  1. $ bentoml list
    Tag Size Creation Time Path
    cancer_classifier:apmmnnyq22egxjcc 32.96 KiB 2022-07-31 19:08:13 ~\bentoml\bentos\cancer_classifier\apmmnnyq22egxjcc

  2. bentofile.yaml
    service: "service:svc"
    description: "My XGBoost service"
    python:
    packages:

    • xgboost
  3. bentoctl operator install aws-lambda

  4. bentoctl init it produced 3 files --> deployment_config.yaml, bentoctl.tfvars, main.tf

  • deployment_config.yaml :
  api_version: v1
  name: demo
  operator:
    name: aws-lambda
  template: terraform
  spec:
    region: us-east-2
    timeout: 10
    memory_size: 512
  • bentoctl.tfvars
# This file is maintained automatically by 
# "bentoctl generate" and "bentoctl build" commands. 
# Manual edits may be lost the next time these commands are run.

deployment_name = "demo"
region = "us-east-2"
timeout = "10"
memory_size = "512"
  • main.tf
terraform {
 required_providers {
   aws = {
     source  = "hashicorp/aws"
     version = "~> 4.0.0"
   }
 }

 required_version = "~> 1.0"
}

provider "aws" {
 region = var.region
}
and more details

6. bentoctl build -b cancer_classifier:apmmnnyq22egxjcc -f deployment_config.yaml
7. See error

Expected behavior
The build for the deployable artifacts required for this deployment shou;d go through but I encounter error as specified in the snapshot attached

terraform init

PS C:\Users\nayak\Documents\BentoML> .\terraform init

Initializing the backend...

Initializing provider plugins...

  • Reusing previous version of hashicorp/aws from the dependency lock file
  • Using previously-installed hashicorp/aws v4.0.0

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

terraform apply -var-file=bentoctl.tfvars --auto-approve
PS C:\Users\nayak\Documents\BentoML> .\terraform apply -var-file=bentoctl.tfvars --auto-approve

│ Error: Too many command line arguments

│ Expected at most one positional argument.

For more help on using this command, run:
terraform apply -help
Screenshots/Logs
bentoctl

-->

Environment:

  • OS: [Windows 10]
  • Python Version [Python 3.9.12]
  • BentoML Version [BentoML-1.0.2]
  • Bentoctl Version [bentoctl-0.3.3]

Additional context
NA

@plaban1981 plaban1981 added the bug Something isn't working label Aug 1, 2022
@jjmachan
Copy link
Contributor

jjmachan commented Aug 1, 2022

Thanks for raising the issue and helping improve bentoctl 😃

This seems like a docker buildx issue. Can you verify if docker and docker buildx is installed properly on your system?

After that, you can try a build in debug mode.
run bentoctl build -b cancer_classifier:apmmnnyq22egxjcc -f deployment_config.yaml --debug --dry-run
This will create the intermediate files in a location and will be logged. change to that directory and perform a docker build docker buildx build -f env/docker/Dockerfile .
can you share the output from that?

@plaban1981
Copy link
Author

plaban1981 commented Aug 1, 2022 via email

@plaban1981
Copy link
Author

dockers1
docker2

@jjmachan
Copy link
Contributor

jjmachan commented Aug 2, 2022

got it! have you verified if docker buildx is working correctly? can you run docker buildx ls and share the output here too?

@plaban1981
Copy link
Author

plaban1981 commented Aug 2, 2022

Have checked in C:\Program Files\Docker\cli-plugins, could find docker_buildx. Have attached the snapshot
docker_buildx

(base) PS C:\Users\nayak> docker --version
Docker version 20.10.10, build b485636
(base) PS C:\Users\nayak> docker-compose --version
docker-compose version 1.29.2, build 5becea4c
(base) PS C:\Users\nayak> **docker ps**
**CONTAINER ID   IMAGE         COMMAND                  CREATED              STATUS              PORTS     NAMES**
**a59b7b6b14c6   hello-world   "/lambda-entrypoint.…"   About a minute ago   Up About a minute             nervous_goodall**
**2d0b5eb60cf6   hello-world   "/lambda-entrypoint.…"   35 minutes ago       Up 35 minutes                 kind_galois**


(base) PS C:\Users\nayak\AppData\Local\Temp\bentoctl-temp-e6s6bjip>
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Build with BuildKit (Docker Inc., v0.6.3)
  compose: Docker Compose (Docker Inc., v2.1.1)
  scan: Docker Scan (Docker Inc., 0.9.0)

Server:
 Containers: 15
  Running: 1
  Paused: 0
  Stopped: 14
 Images: 70
 Server Version: 20.10.10
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 5b46e404f6b9f661a205e28d59c982d3634148f8
 runc version: v1.0.2-0-g52b36a2
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.16.3-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 12.41GiB
 Name: docker-desktop
 ID: QKT6:XI7G:FOU2:Y5YS:KLF6:KHKR:REQO:U634:OTBI:TROO:LCID:HVFC
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support

I still encounter the same error . Can you please guide me how to rectify the error

(base) PS C:\Users\nayak\Documents\BentoML> cd C:\Users\nayak\AppData\Local\Temp\bentoctl-temp-qd5yu1w2
[+] Building 4.5s (16/21)
 => [internal] load build definition from Dockerfile                                                                                                                                                          0.0s
 => => transferring dockerfile: 32B                                                                                                                                                                           0.0s
 => [internal] load .dockerignore                                                                                                                                                                             0.0s
 => => transferring context: 2B                                                                                                                                                                               0.0s
 => resolve image config for docker.io/docker/dockerfile:1.4-labs                                                                                                                                             3.9s
 => CACHED docker-image://docker.io/docker/dockerfile:1.4-labs@sha256:b50ad4af81d1c76ab7c0e1ffc216909e7adc23e99910243e1c88331c2a8ef52d                                                                        0.0s
 => [internal] load .dockerignore                                                                                                                                                                             0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                          0.0s
 => [internal] load metadata for docker.io/library/python:3.9-slim                                                                                                                                            0.0s
 => [stage-0  1/13] FROM docker.io/library/python:3.9-slim                                                                                                                                                    0.0s
 => [internal] load build context                                                                                                                                                                             0.0s
 => => transferring context: 1.15kB                                                                                                                                                                           0.0s
 => CACHED [stage-0  2/13] RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache                                             0.0s
 => CACHED [stage-0  3/13] RUN --mount=type=cache,target=/var/lib/apt     --mount=type=cache,target=/var/cache/apt  apt-get update -y     && apt-get install -q -y --no-install-recommends --allow-remove-es  0.0s
 => CACHED [stage-0  4/13] RUN groupadd -g 1034 -o bentoml && useradd -m -u 1034 -g 1034 -o -r bentoml                                                                                                        0.0s
 => CACHED [stage-0  5/13] RUN mkdir /home/bentoml/bento && chown bentoml:bentoml /home/bentoml/bento -R                                                                                                      0.0s
 => CACHED [stage-0  6/13] WORKDIR /home/bentoml/bento                                                                                                                                                        0.0s
 => CACHED [stage-0  7/13] COPY --chown=bentoml:bentoml . ./                                                                                                                                                  0.0s
 => ERROR [stage-0  8/13] RUN --mount=type=cache,target=/root/.cache/pip bash <<EOF                                                                                                                           0.3s
------
 > [stage-0  8/13] RUN --mount=type=cache,target=/root/.cache/pip bash <<EOF:
: invalid option name1: set: pipefail
------
error: failed to solve: executor failed running [/bin/bash -eo pipefail -c bash <<EOF
set -euxo pipefail

if [ -f /home/bentoml/bento/env/python/install.sh ]; then
  echo "install.sh to install python packages..."
  chmod +x /home/bentoml/bento/env/python/install.sh
  /home/bentoml/bento/env/python/install.sh
fi
EOF]: exit code: 2

@plaban1981
Copy link
Author

plaban1981 commented Aug 2, 2022 via email

@jjmachan
Copy link
Contributor

jjmachan commented Aug 2, 2022

@aarnphm probably has a better idea but it seems like your buildx version is also not up to date. Can you update that and try again? official instructions https://docs.docker.com/build/buildx/install/

@plaban1981
Copy link
Author

Hi @jjmachan ,@aarnphm Please help me with a resolution.

As intsructed have updated buildx
(base) PS C:\Users\nayak> docker pull docker/buildx-bin
Using default tag: latest
latest: Pulling from docker/buildx-bin
879a2709db88: Pull complete
Digest: sha256:44a7217da633dd01f621ebcfe75410cd98f81edcff5b43de33eeb65582d6f055
Status: Downloaded newer image for docker/buildx-bin:latest
docker.io/docker/buildx-bin:latest
(base) PS C:\Users\nayak> docker pull docker/buildx-bin
Using default tag: latest
latest: Pulling from docker/buildx-bin
Digest: sha256:44a7217da633dd01f621ebcfe75410cd98f81edcff5b43de33eeb65582d6f055
Status: Image is up to date for docker/buildx-bin:latest
docker.io/docker/buildx-bin:latest
(base) PS C:\Users\nayak> docker buildx version
github.com/docker/buildx v0.6.3 266c0eac611d64fcc0c72d80206aa364e826758d

(base) PS C:\Users\nayak> docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS PLATFORMS
desktop-linux docker
desktop-linux desktop-linux running linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
default * docker
default default running linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6

I still encounter the same issue
(base) PS C:\Users\nayak\Documents\BentoML> bentoctl build -b cancer_classifier:apmmnnyq22egxjcc -f deployment_config.yaml --debug --dry-run
In debug mode. Intermediate bento saved to C:\Users\nayak\AppData\Local\Temp\bentoctl-temp-slxsmtqs
error: failed to solve: executor failed running [/bin/bash -eo pipefail -c bash <<EOF
set -euxo pipefail

if [ -f /home/bentoml/bento/env/python/install.sh ]; then
echo "install.sh to install python packages..."
chmod +x /home/bentoml/bento/env/python/install.sh
/home/bentoml/bento/env/python/install.sh
fi
EOF]: exit code: 2

@plaban1981
Copy link
Author

plaban1981 commented Aug 2, 2022 via email

@aarnphm
Copy link
Member

aarnphm commented Aug 3, 2022

Can you build the container without bentoctl?

@plaban1981
Copy link
Author

Hi @jjmachan,

Any help to resolve the issue will be highly appreciated

Thanks
Plaban Nayak

@plaban1981
Copy link
Author

plaban1981 commented Aug 3, 2022 via email

@plaban1981
Copy link
Author

bentoml
bentoml2

@aarnphm
Copy link
Member

aarnphm commented Aug 3, 2022

Another quick q, are you running docker from WSL or Docker Desktop?

@plaban1981
Copy link
Author

plaban1981 commented Aug 4, 2022 via email

@aarnphm
Copy link
Member

aarnphm commented Aug 4, 2022

You did say that you have buildx available. 🤔

@plaban1981
Copy link
Author

plaban1981 commented Aug 4, 2022 via email

@aarnphm
Copy link
Member

aarnphm commented Aug 4, 2022

Can you update the buildx version to the latest one and try again?

@plaban1981
Copy link
Author

plaban1981 commented Aug 4, 2022 via email

@plaban1981
Copy link
Author

hi @aarnphm
I did the following steps . But still encounter the same problem.Please
validate and help me in case I am doing something wrong

(base) PS C:\Program Files\Docker\cli-plugins> wget -O ~/.docker-buildx
https://github.com/docker/buildx/releases/download/v0.8.2/buildx-v0.8.2.linux-amd64

<https://github.com/docker/buildx/releases/download/v0.8.2/buildx-v0.8.2.linux-amd64>*
(base) PS C:\Program Files\Docker\cli-plugins> *docker buildx version
github.com/docker/buildx http://github.com/docker/buildx v0.6.3
266c0eac611d64fcc0c72d80206aa364e826758d

(base) PS C:\Program Files\Docker\cli-plugins> docker buildx install
(base) PS C:\Program Files\Docker\cli-plugins> docker buildx version
github.com/docker/buildx http://github.com/docker/buildx v0.6.3
266c0eac611d64fcc0c72d80206aa364e826758d

(base) PS C:\Users\nayak\Documents\BentoML> bentoml list
Tag Size Creation Time Path

  • cancer_classifier:nfhcz6qtxkbedjcc 302.18 MiB 2022-08-04 11:28:09
    ~\bentoml\bentos\cancer_classifier\nfhcz6qtxkbedjcc
    iris_classifier:3vnsv6asmwirhjcc
    15.81 KiB 2022-08-02 18:50:26
    ~\bentoml\bentos\iris_classifier\3vnsv6asmwirhjcc
    iris_classifier:542zfuqsmoi3fjcc
    15.81 KiB 2022-08-02 18:36:37
    ~\bentoml\bentos\iris_classifier\542zfuqsmoi3fjcc
    cancer_classifier:apmmnnyq22egxjcc
    32.96 KiB 2022-07-31 19:08:13
    ~\bentoml\bentos\cancer_classifier\apmmnnyq22egxjcc*
    (base) PS C:\Users\nayak\Documents\BentoML> bentoml models list
    Tag Module Size Creation Time

iris_clf:ye6uidasmwbsdjcc bentoml.sklearn 5.62 KiB 2022-08-02
18:49:36 iris_clf:5fxmxcasmon5ljcc bentoml.sklearn 5.62 KiB
2022-08-02 18:36:24 booster_tree:jjzrgfqq2kolbjcc bentoml.xgboost 23.30
KiB 2022-07-31 18:41:29

(base) PS C:\Users\nayak\Documents\BentoML> bentoctl init
Bentoctl Interactive Deployment Config Builder

Welcome! You are now in interactive mode.

This mode will help you setup the deployment_config.yaml file required for
deployment. Fill out the appropriate values for the fields.

(deployment config will be saved to: ./deployment_config.yaml)

api_version: v1
name: cancer_classifier
operator:
name: aws-lambda
template: terraform
spec:
region: us-east-2
timeout: 15
memory_size: 512
filename for deployment_config [deployment_config.yaml]:
deployment config file exists! Should I override? [Y/n]: Y
deployment config generated to: deployment_config.yaml
✨ generated template files.

  • bentoctl.tfvars
  • main.tf
    (base) PS C:\Users\nayak\Documents\BentoML>

(base) PS C:\Users\nayak\Documents\BentoML>* bentoml containerize
cancer_classifier:latest*

Building docker image for
Bento(tag="cancer_classifier:nfhcz6qtxkbedjcc")...Successfully built docker
image "cancer_classifier:nfhcz6qtxkbedjcc"

To run your newly built Bento container, use: "docker run -it --rm -p
3000:3000 cancer_classifier:nfhcz6qtxkbedjcc"
(base) PS C:\Users\nayak\Documents\BentoML>
(base) PS C:\Users\nayak\Documents\BentoML>* docker run -it --rm -p
3000:3000 cancer_classifier:nfhcz6qtxkbedjcc*
2022-08-04T06:04:50+0000 [INFO] [cli] Service loaded from Bento directory:
bentoml.Service(tag="cancer_classifier:nfhcz6qtxkbedjcc",
path="/home/bentoml/bento/")
2022-08-04T06:04:51+0000 [INFO] [cli] Starting production BentoServer from
"/home/bentoml/bento" running on http://0.0.0.0:3000/ http://0.0.0.0:3000/
(Press CTRL+C to quit)

2022-08-04T06:04:52+0000 [INFO] [api_server:8] Service loaded from Bento
directory: bentoml.Service(tag="cancer_classifier:nfhcz6qtxkbedjcc",
path="/home/bentoml/bento/")
2022-08-04T06:04:52+0000 [INFO] [api_server:1] Service loaded from Bento
directory: bentoml.Service(tag="cancer_classifier:nfhcz6qtxkbedjcc",
path="/home/bentoml/bento/")
2022-08-04T06:04:52+0000 [INFO] [api_server:2] Service loaded from Bento
directory: bentoml.Service(tag="cancer_classifier:nfhcz6qtxkbedjcc",
path="/home/bentoml/bento/")
2022-08-04T06:04:52+0000 [INFO] [api_server:5] Service loaded from Bento
directory: bentoml.Service(tag="cancer_classifier:nfhcz6qtxkbedjcc",
path="/home/bentoml/bento/")
2022-08-04T06:04:52+0000 [INFO] [api_server:4] Service loaded from Bento
directory: bentoml.Service(tag="cancer_classifier:nfhcz6qtxkbedjcc",
path="/home/bentoml/bento/")
2022-08-04T06:04:52+0000 [INFO] [runner:booster_tree:1] Service loaded from
Bento directory: bentoml.Service(tag="cancer_classifier:nfhcz6qtxkbedjcc",
path="/home/bentoml/bento/")
2022-08-04T06:04:52+0000 [INFO] [api_server:11] Service loaded from Bento
directory: bentoml.Service(tag="cancer_classifier:nfhcz6qtxkbedjcc",
path="/home/bentoml/bento/")
2022-08-04T06:04:52+0000 [INFO] [api_server:6] Service loaded from Bento
directory: bentoml.Service(tag="cancer_classifier:nfhcz6qtxkbedjcc",
path="/home/bentoml/bento/")
2022-08-04T06:04:52+0000 [INFO] [api_server:7] Service loaded from Bento
directory: bentoml.Service(tag="cancer_classifier:nfhcz6qtxkbedjcc",
path="/home/bentoml/bento/")
2022-08-04T06:04:52+0000 [INFO] [runner:booster_tree:1] Setting up worker:
set CPU thread count to 12
2022-08-04T06:04:52+0000 [INFO] [api_server:9] Service loaded from Bento
directory: bentoml.Service(tag="cancer_classifier:nfhcz6qtxkbedjcc",
path="/home/bentoml/bento/")
2022-08-04T06:04:52+0000 [INFO] [api_server:10] Service loaded from Bento
directory: bentoml.Service(tag="cancer_classifier:nfhcz6qtxkbedjcc",
path="/home/bentoml/bento/")
2022-08-04T06:04:53+0000 [INFO] [api_server:12] Service loaded from Bento
directory: bentoml.Service(tag="cancer_classifier:nfhcz6qtxkbedjcc",
path="/home/bentoml/bento/")
2022-08-04T06:04:53+0000 [INFO] [api_server:3] Service loaded from Bento
directory: bentoml.Service(tag="cancer_classifier:nfhcz6qtxkbedjcc",
path="/home/bentoml/bento/")
2022-08-04T06:05:10+0000 [INFO] [api_server:3] 172.17.0.1:53698
(scheme=http,method=GET,path=/,type=,length=) (status=200,type=text/html;
charset=utf-8,length=790) 0.001ms
(trace=220516410139264950285412778910954192211,span=9316540740728650785,sampled=0)
2022-08-04T06:05:10+0000 [INFO] [api_server:3] 172.17.0.1:53698
(scheme=http,method=GET,path=/static_content/swagger-ui.css,type=,length=)
(status=200,type=text/css; charset=utf-8,length=143980) 0.012ms
(trace=179842158731351380507878764366801059637,span=13079929633582253200,sampled=0)
2022-08-04T06:05:10+0000 [INFO] [api_server:12] 172.17.0.1:53696
(scheme=http,method=GET,path=/static_content/index.css,type=,length=)
(status=200,type=text/css; charset=utf-8,length=233) 0.014ms
(trace=277742223342556230769942546004769615448,span=14678345293950772487,sampled=0)
2022-08-04T06:05:10+0000 [INFO] [api_server:9] 172.17.0.1:53710
(scheme=http,method=GET,path=/static_content/swagger-initializer.js,type=,length=)
(status=200,type=application/javascript,length=382) 0.012ms
(trace=134834640285538420263163172767507914351,span=4990766697434115548,sampled=0)
2022-08-04T06:05:10+0000 [INFO] [api_server:7] 172.17.0.1:53706
(scheme=http,method=GET,path=/static_content/swagger-ui-standalone-preset.js,type=,length=)
(status=200,type=application/javascript,length=339540) 0.018ms
(trace=238765016389083102165471097661395348822,span=5832496162839042442,sampled=0)
2022-08-04T06:05:10+0000 [INFO] [api_server:10] 172.17.0.1:53702
(scheme=http,method=GET,path=/static_content/swagger-ui-bundle.js,type=,length=)
(status=200,type=application/javascript,length=1096221) 0.024ms
(trace=218752250589705974188965646825831090603,span=9157418109145729948,sampled=0)
2022-08-04T06:05:10+0000 [INFO] [api_server:10] 172.17.0.1:53702
(scheme=http,method=GET,path=/docs.json,type=,length=)
(status=200,type=application/json,length=1753) 0.001ms
(trace=282291790197061191952152831741196946713,span=16051579166601308355,sampled=0)

(base) PS C:\Users\nayak\Documents\BentoML>* bentoctl build -b
cancer_classifier:apmmnnyq22egxjcc -f deployment_config.yaml*

error: failed to solve: executor failed running [/bin/bash -eo pipefail -c
bash <<EOFset -euxo pipefail

if [ -f /home/bentoml/bento/env/python/install.sh ]; then
echo "install.sh to install python packages..."
chmod +x /home/bentoml/bento/env/python/install.sh
/home/bentoml/bento/env/python/install.sh
fi
EOF]: exit code: 2
Traceback (most recent call last):
File "C:\Users\nayak\anaconda3\lib\runpy.py", line 197, in
_run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\nayak\anaconda3\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\nayak\anaconda3\Scripts\bentoctl.exe_main
.py", line 7,
in
sys.exit(bentoctl())
File
"C:\Users\nayak\AppData\Roaming\Python\Python39\site-packages\click\core.py",
line 1130, in call
return self.main(*args, **kwargs)
File
"C:\Users\nayak\AppData\Roaming\Python\Python39\site-packages\click\core.py",
line 1055, in main
rv = self.invoke(ctx)
File
"C:\Users\nayak\AppData\Roaming\Python\Python39\site-packages\click\core.py",
line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File
"C:\Users\nayak\AppData\Roaming\Python\Python39\site-packages\click\core.py",
line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File
"C:\Users\nayak\AppData\Roaming\Python\Python39\site-packages\click\core.py",
line 760, in invoke
return _callback(*args, **kwargs)
File "C:\Users\nayak\anaconda3\lib\site-packages\bentoctl\cli\utils.py",
line 90, in wrapper
return_value = func(*args, **kwargs)
File "C:\Users\nayak\anaconda3\lib\site-packages\bentoctl\cli\utils.py",
line 55, in wrapper
return func(*args, **kwargs)
File "C:\Users\nayak\anaconda3\lib\site-packages\bentoctl\cli\utils.py",
line 24, in wrapper
return func(*args, **kwargs)
File
"C:\Users\nayak\anaconda3\lib\site-packages\bentoctl\cli_init
.py", line
147, in build
generate_deployable_container(
File
"C:\Users\nayak\anaconda3\lib\site-packages\bentoctl\docker_utils.py", line
99, in generate_deployable_container
buildx.build(**buildx_args)
File
"C:\Users\nayak\anaconda3\lib\site-packages\bentoml_internal\utils\buildx.py",
line 301, in build
run_docker_cmd(cmds, env=subprocess_env, cwd=cwd)
File
"C:\Users\nayak\anaconda3\lib\site-packages\bentoml_internal\utils\buildx.py",
line 314, in run_docker_cmd
subprocess.check_output(list(map(str, cmds)), env=subprocess_env,
cwd=cwd)
File "C:\Users\nayak\anaconda3\lib\subprocess.py", line 424, in
check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "C:\Users\nayak\anaconda3\lib\subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['docker', 'buildx', 'build',
'--progress', 'auto', '--tag',
'aws-lambda-cancer_classifier:apmmnnyq22egxjcc', '--platform',
'linux/amd64', '--file', 'env/docker/Dockerfile', '.']' returned non-zero
exit status 1.

(base) PS C:\Users\nayak\Documents\BentoML>
Thanks,
Plaban Nayak

@plaban1981
Copy link
Author

plaban1981 commented Aug 4, 2022

Hi @jjmachan ,@aarnphm,

My docker buildx version is now up to date
(base) PS C:\Program Files\Docker\cli-plugins> docker buildx version
github.com/docker/buildx v0.8.2 6224def4dd2c3d347eee19db595348c50d7cb491

Details of docker file

1. C:\Users\nayak\bentoml\bentos\cancer_classifier\apmmnnyq22egxjcc\env\docker\DockerFile

# syntax = docker/dockerfile:1.4-labs
#
# ===========================================
#
# THIS IS A GENERATED DOCKERFILE. DO NOT EDIT
#
# ===========================================

# Block SETUP_BENTO_BASE_IMAGE
FROM python:3.9-slim

ENV LANG=C.UTF-8

ENV LC_ALL=C.UTF-8

ENV PYTHONIOENCODING=UTF-8

ENV PYTHONUNBUFFERED=1


USER root

ENV DEBIAN_FRONTEND=noninteractive
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
RUN --mount=type=cache,target=/var/lib/apt \ 
    --mount=type=cache,target=/var/cache/apt \
	apt-get update -y \
    && apt-get install -q -y --no-install-recommends --allow-remove-essential \
		ca-certificates gnupg2 bash build-essential


# Block SETUP_BENTO_USER
ARG BENTO_USER=bentoml
ARG BENTO_USER_UID=1034
ARG BENTO_USER_GID=1034
RUN groupadd -g $BENTO_USER_GID -o $BENTO_USER && useradd -m -u $BENTO_USER_UID -g $BENTO_USER_GID -o -r $BENTO_USER
SHELL [ "/bin/bash", "-eo", "pipefail", "-c" ]
ARG BENTO_PATH=/home/bentoml/bento
ENV BENTO_PATH=$BENTO_PATH
ENV BENTOML_HOME=/home/bentoml/

RUN mkdir $BENTO_PATH && chown bentoml:bentoml $BENTO_PATH -R
WORKDIR $BENTO_PATH

# init related components
COPY --chown=bentoml:bentoml . ./



# Block SETUP_BENTO_COMPONENTS

# Running install.sh to install python packages
RUN --mount=type=cache,target=/root/.cache/pip bash <<EOF
set -euxo pipefail

if [ -f /home/bentoml/bento/env/python/install.sh ]; then
  echo "install.sh to install python packages..."
  chmod +x /home/bentoml/bento/env/python/install.sh
  /home/bentoml/bento/env/python/install.sh
fi
EOF

# Running user setup scripts
RUN  bash <<EOF
set -euxo pipefail

if [ -f /home/bentoml/bento/env/docker/setup_script ]; then
  echo "user setup scripts..."
  chmod +x /home/bentoml/bento/env/docker/setup_script
  /home/bentoml/bento/env/docker/setup_script
fi
EOF


# Block SETUP_BENTO_ENTRYPOINT
RUN rm -rf /var/lib/{apt,cache,log}
# Default port for BentoServer
EXPOSE 3000

RUN chmod +x /home/bentoml/bento/env/docker/entrypoint.sh

USER bentoml

ENTRYPOINT [ "/home/bentoml/bento/env/docker/entrypoint.sh" ]

CMD [ "bentoml", "serve", "/home/bentoml/bento", "--production" ]

@plaban1981
Copy link
Author

plaban1981 commented Aug 4, 2022

2. C:\Users\nayak\AppData\Local\Temp\bentoctl-temp-upibeijr\env\docker\Dockerfile

# syntax = docker/dockerfile:1.4-labs
#
# ===========================================
#
# THIS IS A GENERATED DOCKERFILE. DO NOT EDIT
#
# ===========================================

# Block SETUP_BENTO_BASE_IMAGE
FROM python:3.9-slim

ENV LANG=C.UTF-8

ENV LC_ALL=C.UTF-8

ENV PYTHONIOENCODING=UTF-8

ENV PYTHONUNBUFFERED=1


USER root

ENV DEBIAN_FRONTEND=noninteractive
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
RUN --mount=type=cache,target=/var/lib/apt \ 
    --mount=type=cache,target=/var/cache/apt \
	apt-get update -y \
    && apt-get install -q -y --no-install-recommends --allow-remove-essential \
		ca-certificates gnupg2 bash build-essential


# Block SETUP_BENTO_USER
ARG BENTO_USER=bentoml
ARG BENTO_USER_UID=1034
ARG BENTO_USER_GID=1034
RUN groupadd -g $BENTO_USER_GID -o $BENTO_USER && useradd -m -u $BENTO_USER_UID -g $BENTO_USER_GID -o -r $BENTO_USER
SHELL [ "/bin/bash", "-eo", "pipefail", "-c" ]
ARG BENTO_PATH=/home/bentoml/bento
ENV BENTO_PATH=$BENTO_PATH
ENV BENTOML_HOME=/tmp

RUN mkdir $BENTO_PATH && chown bentoml:bentoml $BENTO_PATH -R
WORKDIR $BENTO_PATH

# init related components
COPY --chown=bentoml:bentoml . ./



# Block SETUP_BENTO_COMPONENTS

# Running install.sh to install python packages
RUN --mount=type=cache,target=/root/.cache/pip bash <<EOF
set -euxo pipefail

if [ -f /home/bentoml/bento/env/python/install.sh ]; then
  echo "install.sh to install python packages..."
  chmod +x /home/bentoml/bento/env/python/install.sh
  /home/bentoml/bento/env/python/install.sh
fi
EOF

# Running user setup scripts
RUN  bash <<EOF
set -euxo pipefail

if [ -f /home/bentoml/bento/env/docker/setup_script ]; then
  echo "user setup scripts..."
  chmod +x /home/bentoml/bento/env/docker/setup_script
  /home/bentoml/bento/env/docker/setup_script
fi
EOF


# Block SETUP_BENTO_ENTRYPOINT
EXPOSE 3000

ENV BENTOML_CONFIG=/home/bentoml/bento/bentoml_config.yaml

RUN --mount=type=cache,target=/root/.cache/pip pip install awslambdaric==2.0.0 mangum==0.12.3

USER root
ADD ./aws-lambda-rie /usr/local/bin/aws-lambda-rie
RUN chmod +x /usr/local/bin/aws-lambda-rie
RUN chmod +x /home/bentoml/bento/env/docker/entry_script.sh
ENTRYPOINT ["/home/bentoml/bento/env/docker/entry_script.sh"]

@jjmachan jjmachan changed the title error: failed to solve: executor failed running [/bin/bash -eo pipefail -c bash <<EOF set -euxo pipefail error with line endings when generating Dockerfile on windows systems Aug 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants