首页 > 解决方案 > ping 命令未显示在 Heroku 堆栈中(Ubuntu 20.04)

问题描述

Heroku 默认堆栈中没有 ping 命令(使用 Ubuntu 20.04)。我已经使用 buildpack 安装了包“iputils-ping”,但是它没有显示“找不到命令”。还尝试使用 buildpack 的 Aptfile 中特定 .deb 文件的链接。

显示它已安装的部署日志,但是在完成后,找不到命令。无论如何我可以安装该软件包并使用我的python脚本中的ping命令进行部署。

$ git push heroku master
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 360 bytes | 360.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpacks:
remote:        1. https://github.com/heroku/heroku-buildpack-apt
remote:        2. heroku-community/apt
remote:        3. heroku/python
remote: -----> Apt app detected
remote: -----> Detected Aptfile or Stack changes, flushing cache
remote: -----> Updating apt caches
remote:        Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
remote:        Hit:2 http://archive.ubuntu.com/ubuntu focal-security InRelease
remote:        Hit:3 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease
remote:        Hit:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
remote:        Reading package lists...
remote: -----> Fetching .debs for iputils-ping
remote:        Reading package lists...
remote:        Building dependency tree...
remote:        The following NEW packages will be installed:
remote:          iputils-ping
remote:        0 upgraded, 1 newly installed, 0 to remove and 12 not upgraded.
remote:        Need to get 40.1 kB of archives.
remote:        After this operation, 108 kB of additional disk space will be used.
remote:        Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 iputils-ping amd64 3:20190709-3 [40.1 kB]
remote:        Fetched 40.1 kB in 0s (151 kB/s)
remote:        Download complete and in download only mode
remote: -----> Fetching http://kr.archive.ubuntu.com/ubuntu/pool/main/i/iputils/iputils-ping_20210202-1_amd64.deb
remote: -----> Installing iputils-ping_20210202-1_amd64.deb
remote: -----> Installing iputils-ping_3%3a20190709-3_amd64.deb
remote: -----> Writing profile script
remote: -----> Rewrite package-config files
remote: -----> Apt app detected
remote: -----> Reusing cache
remote: -----> Updating apt caches
remote:        Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
remote:        Hit:2 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease
remote:        Hit:3 http://archive.ubuntu.com/ubuntu focal-security InRelease
remote:        Hit:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
remote:        Reading package lists...
remote: -----> Fetching .debs for iputils-ping
remote:        Reading package lists...
remote:        Building dependency tree...
remote:        The following NEW packages will be installed:
remote:          iputils-ping
remote:        0 upgraded, 1 newly installed, 0 to remove and 12 not upgraded.
remote:        Need to get 0 B/40.1 kB of archives.
remote:        After this operation, 108 kB of additional disk space will be used.
remote:        Download complete and in download only mode
remote: -----> Fetching http://kr.archive.ubuntu.com/ubuntu/pool/main/i/iputils/iputils-ping_20210202-1_amd64.deb
remote: -----> Installing iputils-ping_20210202-1_amd64.deb
remote: -----> Installing iputils-ping_3%3a20190709-3_amd64.deb
remote: -----> Writing profile script
remote: -----> Rewrite package-config files
remote: -----> Python app detected
remote: -----> No Python version was specified. Using the same version as the last build: python-3.9.5
remote:        To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> No change in requirements detected, installing from cache
remote: -----> Using cached install of python-3.9.5
remote: -----> Installing pip 20.2.4, setuptools 47.1.1 and wheel 0.36.2
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote: 

标签: pythonubuntuherokuping

解决方案


它已安装,但是我无法在我的 Python 程序中使用此命令,因为“ping”命令需要 root 权限才能执行 Heroku 不允许:(

~ $ which ping
/bin/ping
~ $ 

推荐阅读