Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harbor ./prepare error on Ubuntu 24.04 #21200

Open
mehdiMj-ir opened this issue Nov 17, 2024 · 6 comments
Open

Harbor ./prepare error on Ubuntu 24.04 #21200

mehdiMj-ir opened this issue Nov 17, 2024 · 6 comments
Assignees

Comments

@mehdiMj-ir
Copy link

Expected behavior and actual behavior:
I have installed new Ubuntu Server 24.04 on my ESXi 8 with Docker CE 27.3.1 and expected to run Harbor with no problem but I'm getting error while ./prepare the service.

Steps to reproduce the problem:
Install Ubuntu 24.04 and Docker CE and try to install harbor online installation.

Versions:

  • harbor version: [2.12.0]
  • docker engine version: [27.3.1]
  • docker-compose version: [v2.29.7]

Additional context:
It was looking for python 3.11 but the default python version on Ubuntu 24.04 is 3.12.3 so I tried to install python 3.11 via PPA and set as primary using update-alternatives but didn't work

root@my-server:/opt/harbor# ./install.sh --with-trivy

[Step 0]: checking if docker is installed ...

Note: docker version: 27.3.1

[Step 1]: checking docker-compose is installed ...

Note: Docker Compose version v2.29.7


[Step 2]: preparing environment ...

[Step 3]: preparing harbor configs ...
prepare base dir is set to /opt/harbor
Traceback (most recent call last):
  File "/usr/src/app/main.py", line 15, in <module>
    cli()
  File "/usr/lib/python3.11/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/app/commands/prepare.py", line 33, in prepare
    config_dict = parse_yaml_config(conf, with_trivy=with_trivy)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/app/utils/configs.py", line 107, in parse_yaml_config
    configs = yaml.safe_load(f)
              ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/yaml/__init__.py", line 162, in safe_load
    return load(stream, SafeLoader)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/yaml/constructor.py", line 49, in get_single_data
    node = self.get_single_node()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/yaml/parser.py", line 428, in parse_block_mapping_key
    if self.check_token(KeyToken):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/yaml/scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "/usr/lib/python3.11/site-packages/yaml/scanner.py", line 223, in fetch_more_tokens
    return self.fetch_value()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/yaml/scanner.py", line 577, in fetch_value
    raise ScannerError(None, None,
yaml.scanner.ScannerError: mapping values are not allowed here
  in "/input/harbor.yml", line 46, column 8   
@mehdiMj-ir
Copy link
Author

I think it's looking for docker-compose which it doesn't installed by default and docker uses docker compose instead!
I know it can be installed standalone but It would be better If it can work with docker compose too.
Screenshot_20241118_081337

@MinerYang
Copy link
Contributor

How do you install your docker? Have you install the docker via apt get?

@MinerYang MinerYang self-assigned this Nov 18, 2024
@mehdiMj-ir
Copy link
Author

Yes, I just copy and paste commands from docker documentations

@mehdiMj-ir
Copy link
Author

mehdiMj-ir commented Nov 18, 2024

Sorry, I double checked my grep command and I should have put it between ", but beside that I still have issue
Screenshot_20241118_121257

@MinerYang
Copy link
Contributor

it should work with 'docker compose'. Do you still have the same error msg pasted above? if so could you provide your harbor.yaml file, and kindly check if it is with correct yaml syntax.

@mehdiMj-ir
Copy link
Author

Yes I had problem, here is my harbor.yml config

hostname: dr.mysite.dev

https:
  port: 8443
  certificate: /etc/ssl/certs/mysite.pem
  private_key: /etc/ssl/private/mysite.key
  external_url: https://dr.mysite.dev:8433
harbor_admin_password: xyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyz
database:
  password: zyxzyxzyxzyxzyxzyxzyx
  max_idle_conns: 100
  max_open_conns: 900
  conn_max_lifetime: 5m
  conn_max_idle_time: 0

data_volume: /harbor_docker_data

trivy:
  ignore_unfixed: false
  skip_update: false
  skip_java_db_update: false
  offline_scan: false
  security_check: vuln
  insecure: false
  timeout: 5m0s

jobservice:
  max_job_workers: 10
  job_loggers:
    - STD_OUTPUT
    - FILE
  logger_sweeper_duration: 1 #days

notification:
  webhook_job_max_retry: 3
  webhook_job_http_client_timeout: 5 #seconds

log:
  level: info
  local:
    rotate_count: 50
    rotate_size: 200M
    location: /var/log/harbor

_version: 2.12.0
  proxy:
  http_proxy:
  https_proxy:
  no_proxy:
  components:
    - core
    - jobservice
    - trivy
upload_purging:
  enabled: true
  age: 168h
  interval: 24h
  dryrun: false
cache:
  enabled: false
  expire_hours: 24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants