首页 > 解决方案 > Dokku:未能推送一些裁判

问题描述

我有一个 asp.net core 3.1 应用程序,我正在尝试使用 dokku 将其部署到我在数字海洋上的 Ubuntu 20 VM。我已经在我的 Droplet 上安装了 Dokku,但我在这git push aspnetapp master一步失败,并出现下面列出的错误。我正在使用此处列出的步骤,我的机器操作系统是 Windows 10。

我错过了什么?

error: src refspec master does not match any
error: failed to push some refs to 'dokku@ubuntu-s-1vcpu-1gb-nyc1-01:aspnetapp'

Dockerfile:

# https://hub.docker.com/_/microsoft-dotnet-core
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
RUN dotnet restore

# copy everything else and build app
COPY aspnetapp/. ./aspnetapp/
WORKDIR /source/aspnetapp
RUN dotnet publish -c release -o /app --no-restore

# final stage/image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
ENV ASPNETCORE_URLS http://*:5000
WORKDIR /app
COPY --from=build /app ./
ENTRYPOINT ["dotnet", "aspnetapp.dll"]

Digital Ocean:Dokku-安装输出:

root@ubuntu-s-1vcpu-1gb-nyc1-01:~# wget https://raw.githubusercontent.com/dokku/                                  dokku/v0.21.4/bootstrap.sh
--2020-10-31 21:33:20--  https://raw.githubusercontent.com/dokku/dokku/v0.21.4/b                                  ootstrap.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.208.1                                  33
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.208.                                  133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8453 (8.3K) [text/plain]
Saving to: ‘bootstrap.sh’

bootstrap.sh        100%[===================>]   8.25K  --.-KB/s    in 0s

2020-10-31 21:33:20 (38.2 MB/s) - ‘bootstrap.sh’ saved [8453/8453]

root@ubuntu-s-1vcpu-1gb-nyc1-01:~# sudo DOKKU_TAG=v0.21.4 bash bootstrap.sh
Preparing to install v0.21.4 from https://github.com/dokku/dokku.git...
--> Ensuring we have the proper dependencies
--> Initial apt-get update
Selecting previously unselected package apt-transport-https.
(Reading database ... 63395 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_2.0.2ubuntu0.1_all.deb ...
Unpacking apt-transport-https (2.0.2ubuntu0.1) ...
Setting up apt-transport-https (2.0.2ubuntu0.1) ...
--> Installing docker
# Executing docker install script, commit: 26ff363bcf3b3f5a00498ac43694bf1c7d9ce                                  16c
2020-10-31 21:34:12 URL:https://get.docker.com/ [13857/13857] -> "-" [1]
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-http                                  s ca-certificates curl >/dev/null
+ sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | apt-key add                                   -qq - >/dev/null
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sh -c echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal st                                  able" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
+ [ -n  ]
+ sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
+ sh -c docker version
Client: Docker Engine - Community
 Version:           19.03.13
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        4484c46d9d
 Built:             Wed Sep 16 17:02:52 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.13
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       4484c46d9d
  Built:            Wed Sep 16 17:01:20 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.3.7
  GitCommit:        8fba4e9a7d01810a393d5d25a3621dc101981175
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker your-user

Remember that you will have to log out and back in for this to take effect!

WARNING: Adding a user to the "docker" group will grant the ability to run
         containers which can be used to obtain root privileges on the
         docker host.
         Refer to https://docs.docker.com/engine/security/security/#docker-daemo                                  n-attack-surface
         for more information.
--> Installing dokku
2020-10-31 21:36:27 URL:https://d28dx6y1hfq314.cloudfront.net/505/623/gpg/dokku-                                  dokku-FB2B6AA421CD193F.pub.gpg?t=1604180487_b0707be261a93dd343e056d1db1b69d643fd                                  9a6c [3937/3937] -> "-" [1]
OK
deb https://packagecloud.io/dokku/dokku/ubuntu/ focal main
Extracting templates from packages: 100%
Preconfiguring packages ...
Selecting previously unselected package gliderlabs-sigil.
(Reading database ... 63640 files and directories currently installed.)
Preparing to unpack .../00-gliderlabs-sigil_0.6.0_amd64.deb ...
Unpacking gliderlabs-sigil (0.6.0) ...
Selecting previously unselected package nginx-common.
Preparing to unpack .../01-nginx-common_1.18.0-0ubuntu1_all.deb ...
Unpacking nginx-common (1.18.0-0ubuntu1) ...
Selecting previously unselected package fonts-dejavu-core.
Preparing to unpack .../02-fonts-dejavu-core_2.37-1_all.deb ...
Unpacking fonts-dejavu-core (2.37-1) ...
Selecting previously unselected package fontconfig-config.
Preparing to unpack .../03-fontconfig-config_2.13.1-2ubuntu3_all.deb ...
Unpacking fontconfig-config (2.13.1-2ubuntu3) ...
Selecting previously unselected package libfontconfig1:amd64.
Preparing to unpack .../04-libfontconfig1_2.13.1-2ubuntu3_amd64.deb ...
Unpacking libfontconfig1:amd64 (2.13.1-2ubuntu3) ...
Selecting previously unselected package libjpeg-turbo8:amd64.
Preparing to unpack .../05-libjpeg-turbo8_2.0.3-0ubuntu1.20.04.1_amd64.deb ...
Unpacking libjpeg-turbo8:amd64 (2.0.3-0ubuntu1.20.04.1) ...
Selecting previously unselected package libjpeg8:amd64.
Preparing to unpack .../06-libjpeg8_8c-2ubuntu8_amd64.deb ...
Unpacking libjpeg8:amd64 (8c-2ubuntu8) ...
Selecting previously unselected package libjbig0:amd64.
Preparing to unpack .../07-libjbig0_2.1-3.1build1_amd64.deb ...
Unpacking libjbig0:amd64 (2.1-3.1build1) ...
Selecting previously unselected package libwebp6:amd64.
Preparing to unpack .../08-libwebp6_0.6.1-2_amd64.deb ...
Unpacking libwebp6:amd64 (0.6.1-2) ...
Selecting previously unselected package libtiff5:amd64.
Preparing to unpack .../09-libtiff5_4.1.0+git191117-2build1_amd64.deb ...
Unpacking libtiff5:amd64 (4.1.0+git191117-2build1) ...
Selecting previously unselected package libxpm4:amd64.
Preparing to unpack .../10-libxpm4_1%3a3.5.12-1_amd64.deb ...
Unpacking libxpm4:amd64 (1:3.5.12-1) ...
Selecting previously unselected package libgd3:amd64.
Preparing to unpack .../11-libgd3_2.2.5-5.2ubuntu2_amd64.deb ...
Unpacking libgd3:amd64 (2.2.5-5.2ubuntu2) ...
Selecting previously unselected package libnginx-mod-http-image-filter.
Preparing to unpack .../12-libnginx-mod-http-image-filter_1.18.0-0ubuntu1_amd64.                                  deb ...
Unpacking libnginx-mod-http-image-filter (1.18.0-0ubuntu1) ...
Selecting previously unselected package libnginx-mod-http-xslt-filter.
Preparing to unpack .../13-libnginx-mod-http-xslt-filter_1.18.0-0ubuntu1_amd64.d                                  eb ...
Unpacking libnginx-mod-http-xslt-filter (1.18.0-0ubuntu1) ...
Selecting previously unselected package libnginx-mod-mail.
Preparing to unpack .../14-libnginx-mod-mail_1.18.0-0ubuntu1_amd64.deb ...
Unpacking libnginx-mod-mail (1.18.0-0ubuntu1) ...
Selecting previously unselected package libnginx-mod-stream.
Preparing to unpack .../15-libnginx-mod-stream_1.18.0-0ubuntu1_amd64.deb ...
Unpacking libnginx-mod-stream (1.18.0-0ubuntu1) ...
Selecting previously unselected package nginx-core.
Preparing to unpack .../16-nginx-core_1.18.0-0ubuntu1_amd64.deb ...
Unpacking nginx-core (1.18.0-0ubuntu1) ...
Selecting previously unselected package nginx.
Preparing to unpack .../17-nginx_1.18.0-0ubuntu1_all.deb ...
Unpacking nginx (1.18.0-0ubuntu1) ...
Selecting previously unselected package cgroupfs-mount.
Preparing to unpack .../18-cgroupfs-mount_1.4_all.deb ...
Unpacking cgroupfs-mount (1.4) ...
Selecting previously unselected package plugn.
Preparing to unpack .../19-plugn_0.5.0_amd64.deb ...
Unpacking plugn (0.5.0) ...
Selecting previously unselected package sshcommand.
Preparing to unpack .../20-sshcommand_0.11.0_amd64.deb ...
Unpacking sshcommand (0.11.0) ...
Selecting previously unselected package net-tools.
Preparing to unpack .../21-net-tools_1.60+git20180626.aebd88e-1ubuntu1_amd64.deb                                   ...
Unpacking net-tools (1.60+git20180626.aebd88e-1ubuntu1) ...
Selecting previously unselected package procfile-util.
Preparing to unpack .../22-procfile-util_0.11.0_amd64.deb ...
Unpacking procfile-util (0.11.0) ...
Selecting previously unselected package dos2unix.
Preparing to unpack .../23-dos2unix_7.4.0-2_amd64.deb ...
Unpacking dos2unix (7.4.0-2) ...
Selecting previously unselected package libonig5:amd64.
Preparing to unpack .../24-libonig5_6.9.4-1_amd64.deb ...
Unpacking libonig5:amd64 (6.9.4-1) ...
Selecting previously unselected package libjq1:amd64.
Preparing to unpack .../25-libjq1_1.6-1_amd64.deb ...
Unpacking libjq1:amd64 (1.6-1) ...
Selecting previously unselected package jq.
Preparing to unpack .../26-jq_1.6-1_amd64.deb ...
Unpacking jq (1.6-1) ...
Setting up gliderlabs-sigil (0.6.0) ...
Setting up nginx-common (1.18.0-0ubuntu1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /lib                                  /systemd/system/nginx.service.
Setting up fonts-dejavu-core (2.37-1) ...
Setting up fontconfig-config (2.13.1-2ubuntu3) ...
Setting up libfontconfig1:amd64 (2.13.1-2ubuntu3) ...
Setting up libjpeg-turbo8:amd64 (2.0.3-0ubuntu1.20.04.1) ...
Setting up libjpeg8:amd64 (8c-2ubuntu8) ...
Setting up libjbig0:amd64 (2.1-3.1build1) ...
Setting up libwebp6:amd64 (0.6.1-2) ...
Setting up libtiff5:amd64 (4.1.0+git191117-2build1) ...
Setting up libxpm4:amd64 (1:3.5.12-1) ...
Setting up libgd3:amd64 (2.2.5-5.2ubuntu2) ...
Setting up libnginx-mod-http-image-filter (1.18.0-0ubuntu1) ...
Setting up libnginx-mod-http-xslt-filter (1.18.0-0ubuntu1) ...
Setting up libnginx-mod-mail (1.18.0-0ubuntu1) ...
Setting up libnginx-mod-stream (1.18.0-0ubuntu1) ...
Setting up nginx-core (1.18.0-0ubuntu1) ...
Setting up nginx (1.18.0-0ubuntu1) ...
Setting up cgroupfs-mount (1.4) ...
Setting up plugn (0.5.0) ...
Selecting previously unselected package dokku.
(Reading database ... 64058 files and directories currently installed.)
Preparing to unpack .../0-dokku_0.21.4_amd64.deb ...
Reloading nginx configuration (via systemctl): nginx.service.
Error: keyfile '/root/.ssh/id_rsa.pub' not found.
       To deploy, you will need to generate a keypair and add with 'dokku ssh-ke                                  ys:add'.
Unpacking dokku (0.21.4) ...
Selecting previously unselected package herokuish.
Preparing to unpack .../1-herokuish_0.5.18_amd64.deb ...
Unpacking herokuish (0.5.18) ...
Selecting previously unselected package libsensors-config.
Preparing to unpack .../2-libsensors-config_1%3a3.6.0-2ubuntu1_all.deb ...
Unpacking libsensors-config (1:3.6.0-2ubuntu1) ...
Selecting previously unselected package libsensors5:amd64.
Preparing to unpack .../3-libsensors5_1%3a3.6.0-2ubuntu1_amd64.deb ...
Unpacking libsensors5:amd64 (1:3.6.0-2ubuntu1) ...
Selecting previously unselected package sysstat.
Preparing to unpack .../4-sysstat_12.2.0-2_amd64.deb ...
Unpacking sysstat (12.2.0-2) ...
Selecting previously unselected package dokku-event-listener.
Preparing to unpack .../5-dokku-event-listener_0.7.0_amd64.deb ...
Unpacking dokku-event-listener (0.7.0) ...
Selecting previously unselected package parallel.
Preparing to unpack .../6-parallel_20161222-1.1_all.deb ...
Adding 'diversion of /usr/bin/parallel to /usr/bin/parallel.moreutils by paralle                                  l'
Adding 'diversion of /usr/share/man/man1/parallel.1.gz to /usr/share/man/man1/pa                                  rallel.moreutils.1.gz by parallel'
Unpacking parallel (20161222-1.1) ...
Setting up net-tools (1.60+git20180626.aebd88e-1ubuntu1) ...
Setting up sshcommand (0.11.0) ...
Setting up libsensors-config (1:3.6.0-2ubuntu1) ...
Setting up libsensors5:amd64 (1:3.6.0-2ubuntu1) ...
Setting up herokuish (0.5.18) ...
Starting docker
Importing herokuish into docker (around 5 minutes)
v0.5.18: Pulling from gliderlabs/herokuish
f08d8e2a3ba1: Pull complete
3baa9cb2483b: Pull complete
94e5ff4c0b15: Pull complete
1860925334f9: Pull complete
adf91c06c078: Pull complete
f945aa327c67: Pull complete
c0b3fea53361: Pull complete
33c3518bd706: Pull complete
718dfb962167: Pull complete
333ab38d592c: Pull complete
64df9312c992: Pull complete
4b315d0eb43a: Pull complete
df3c87bc93b1: Pull complete
Digest: sha256:ecd9b9873348b6d227fd23b1bb5c461cd9017b835b64b3721eeaece889cacfa6
Status: Downloaded newer image for gliderlabs/herokuish:v0.5.18
docker.io/gliderlabs/herokuish:v0.5.18
Pruning dangling images
Error response from daemon: invalid reference format: repository name must be lowercase
Pruning unused gliderlabs/herokuish images
Error response from daemon: conflict: unable to delete 245de830cb40 (must be forced) - image is referenced in mul tiple repositories
Setting up dos2unix (7.4.0-2) ...
Setting up sysstat (12.2.0-2) ...

Creating config file /etc/default/sysstat with new version
update-alternatives: using /usr/bin/sar.sysstat to provide /usr/bin/sar (sar) in auto mode
Created symlink /etc/systemd/system/multi-user.target.wants/sysstat.service → /lib/systemd/system/sysstat.service .
Setting up procfile-util (0.11.0) ...
Setting up libonig5:amd64 (6.9.4-1) ...
Setting up dokku-event-listener (0.7.0) ...
Created symlink /etc/systemd/system/multi-user.target.wants/dokku-event-listener.target → /etc/systemd/system/dok ku-event-listener.target.
Setting up libjq1:amd64 (1.6-1) ...
Setting up parallel (20161222-1.1) ...
Setting up jq (1.6-1) ...
Setting up dokku (0.21.4) ...
Purging old database entries in /usr/share/man...
Processing manual pages under /usr/share/man...
Updating index cache for path `/usr/share/man/man8'. Wait...mandb: can't open /usr/share/man/./version: No such f ile or directory
mandb: warning: /usr/share/man/man8/lsof.8.gz: bad symlink or ROFF `.so' request
Updating index cache for path `/usr/share/man/man1'. Wait...done.
Checking for stray cats under /usr/share/man...
Checking for stray cats under /var/cache/man...
Purging old database entries in /usr/share/man/zh_CN...
Processing manual pages under /usr/share/man/zh_CN...
Updating index cache for path `/usr/share/man/zh_CN/man1'. Wait...done.
Checking for stray cats under /usr/share/man/zh_CN...
Checking for stray cats under /var/cache/man/zh_CN...
Processing manual pages under /usr/share/man/uk...
Updating index cache for path `/usr/share/man/uk/man1'. Wait...done.
Checking for stray cats under /usr/share/man/uk...
Checking for stray cats under /var/cache/man/uk...
Purging old database entries in /usr/share/man/de...
Processing manual pages under /usr/share/man/de...
Updating index cache for path `/usr/share/man/de/man1'. Wait...done.
Checking for stray cats under /usr/share/man/de...
Checking for stray cats under /var/cache/man/de...
Purging old database entries in /usr/share/man/sv...
Processing manual pages under /usr/share/man/sv...
Updating index cache for path `/usr/share/man/sv/man1'. Wait...done.
Checking for stray cats under /usr/share/man/sv...
Checking for stray cats under /var/cache/man/sv...
Purging old database entries in /usr/share/man/ru...
Processing manual pages under /usr/share/man/ru...
Purging old database entries in /usr/share/man/nl...
Processing manual pages under /usr/share/man/nl...
Updating index cache for path `/usr/share/man/nl/man1'. Wait...done.
Checking for stray cats under /usr/share/man/nl...
Checking for stray cats under /var/cache/man/nl...
Purging old database entries in /usr/share/man/zh_TW...
Processing manual pages under /usr/share/man/zh_TW...
Purging old database entries in /usr/share/man/ja...
Processing manual pages under /usr/share/man/ja...
Purging old database entries in /usr/share/man/hu...
Processing manual pages under /usr/share/man/hu...
Purging old database entries in /usr/share/man/fr...
Processing manual pages under /usr/share/man/fr...
Updating index cache for path `/usr/share/man/fr/man1'. Wait...done.
Checking for stray cats under /usr/share/man/fr...
Checking for stray cats under /var/cache/man/fr...
Purging old database entries in /usr/share/man/pt...
Processing manual pages under /usr/share/man/pt...
Purging old database entries in /usr/share/man/da...
Processing manual pages under /usr/share/man/da...
Purging old database entries in /usr/share/man/it...
Processing manual pages under /usr/share/man/it...
Purging old database entries in /usr/share/man/sr...
Processing manual pages under /usr/share/man/sr...
Purging old database entries in /usr/share/man/es...
Processing manual pages under /usr/share/man/es...
Updating index cache for path `/usr/share/man/es/man1'. Wait...done.
Checking for stray cats under /usr/share/man/es...
Checking for stray cats under /var/cache/man/es...
Purging old database entries in /usr/share/man/sl...
Processing manual pages under /usr/share/man/sl...
Purging old database entries in /usr/share/man/cs...
Processing manual pages under /usr/share/man/cs...
Purging old database entries in /usr/share/man/ko...
Processing manual pages under /usr/share/man/ko...
Purging old database entries in /usr/share/man/pt_BR...
Processing manual pages under /usr/share/man/pt_BR...
Updating index cache for path `/usr/share/man/pt_BR/man1'. Wait...done.
Checking for stray cats under /usr/share/man/pt_BR...
Checking for stray cats under /var/cache/man/pt_BR...
Purging old database entries in /usr/share/man/fi...
Processing manual pages under /usr/share/man/fi...
Purging old database entries in /usr/share/man/pl...
Processing manual pages under /usr/share/man/pl...
Updating index cache for path `/usr/share/man/pl/man1'. Wait...done.
Checking for stray cats under /usr/share/man/pl...
Checking for stray cats under /var/cache/man/pl...
Purging old database entries in /usr/share/man/id...
Processing manual pages under /usr/share/man/id...
Purging old database entries in /usr/share/man/tr...
Processing manual pages under /usr/share/man/tr...
Processing manual pages under /usr/local/man...
17 man subdirectories contained newer manual pages.
104 manual pages were added.
0 stray cats were added.
5 old database entries were purged.
Setting up dokku user
Adding user `dokku' ...
Adding new group `dokku' (1000) ...
Adding new user `dokku' (1000) with group `dokku' ...
Creating home directory `/home/dokku' ...
Copying files from `/etc/skel' ...
docker:x:998:
Setting up storage directories
Setting up plugin directories
Migrating old plugins
Enabling all core plugins
Install all core plugins
Generating DH parameters, 2048 bit long safe prime, generator 2
This is going to take a long time
....................................................................................+............................ .................+............................................................................................... .................................................................................................+............... ....................................................................................................+............ .............................................+..................+.....................+.......................... .+.........................+...............................+...............................................++*++* ++*++*
Adding user dokku to group adm
Starting nginx (via systemctl): nginx.service.
-----> Priming bash-completion cache
Ensure proper sshcommand path
Setting up dokku-installer
Enabling dokku-installer
Created symlink /etc/systemd/system/multi-user.target.wants/dokku-installer.service → /etc/systemd/system/dokku-i nstaller.service.
Created symlink /etc/systemd/system/graphical.target.wants/dokku-installer.service → /etc/systemd/system/dokku-in staller.service.
Starting dokku-installer
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...
Processing triggers for ufw (0.36-6) ...
Processing triggers for systemd (245.4-4ubuntu3.2) ...
Processing triggers for man-db (2.9.1-1) ...
--> Running post-install dependency installation
root@ubuntu-s-1vcpu-1gb-nyc1-01:~# dokku apps:create aspnetapp
-----> Creating aspnetapp...

标签: asp.net-core.net-coredigital-oceandokku

解决方案


您的日志输出表明您看到了错误:

src refspec main does not match any

这表明您实际上是在尝试推送分支main而不是master. 您应该检查您所在的分支 - 可能master?- 而是推动它。

如果您在非主分支上,您可以使用几种不同的方法来推送该分支以进行构建:

# push your branch SOME_BRANCH_NAME
git push dokku SOME_BRANCH_NAME:master

# set the deploy branch for your app
dokku git:set node-js-app deploy-branch SOME_BRANCH_NAME

编辑: OP 在 Dokku slack 频道中发布,事实证明他们从未真正致力于本地的一个main或一个master分支。一旦他们这样做了,他们就能够将他们的分支推到 Dokku。


推荐阅读