惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Know Your Adversary
Know Your Adversary
N
News and Events Feed by Topic
C
CXSECURITY Database RSS Feed - CXSecurity.com
P
Privacy & Cybersecurity Law Blog
P
Privacy International News Feed
Recent Announcements
Recent Announcements
T
Threatpost
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Last Week in AI
Last Week in AI
博客园 - 叶小钗
AWS News Blog
AWS News Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyberwarzone
Cyberwarzone
月光博客
月光博客
The Cloudflare Blog
罗磊的独立博客
P
Palo Alto Networks Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 聂微东
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
Tailwind CSS Blog
PCI Perspectives
PCI Perspectives
Forbes - Security
Forbes - Security
Latest news
Latest news
V
Visual Studio Blog
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
有赞技术团队
有赞技术团队
N
News and Events Feed by Topic
爱范儿
爱范儿
L
Lohrmann on Cybersecurity
Cisco Talos Blog
Cisco Talos Blog
I
Intezer
S
Secure Thoughts
Hacker News: Ask HN
Hacker News: Ask HN
C
CERT Recently Published Vulnerability Notes
TaoSecurity Blog
TaoSecurity Blog
博客园 - 司徒正美
Google DeepMind News
Google DeepMind News
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
H
Hacker News: Front Page
Recent Commits to openclaw:main
Recent Commits to openclaw:main
V2EX - 技术
V2EX - 技术
Microsoft Azure Blog
Microsoft Azure Blog
O
OpenAI News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Webroot Blog
Webroot Blog

Yorksite

Plog006:Pebble Time 2 到了! · Plog Plog005:忙碌的六月 · Plog Plog004:好吃好吃 · Plog Plog003:Until Then · Plog Plog002:春天花会开 · Plog Plog001:让人疲惫的AI与在战锤世界中仰泳,赞美欧姆尼赛亚? · Plog rhaeTree:一个基于 Rust 的进化树可视化编辑工具 · Articles 我的键盘快捷键们 · Articles 迟到的2025年度数码产品总结 · Articles 关于我和这个博客 · Info 买了一只十多年前的老 Pebble · Articles 盘点一下今年让我上头的那些游戏 · Articles 【吃了啥】新利查西菜馆 · Articles 根据Zotero数据库追踪新发表文献 · Articles 又是一个Mac软件列表 · Articles Vita3K存档转移到PSV实机 · Articles SnapGene创建多外显子基因结构 · Articles Rstudio也能用GitHub Copilot了 · Articles 双十一买了啥 · Articles 文献一团乱麻?试试PARA管理方法 · Articles 点名的风还是吹到了Blog · Articles 从Raindrop迁移到了Anybox · Articles 数据可视化——基本图形元素及其应用 · Articles 单变量异常值检测方法 · Articles 复现一张相关性图 · Articles 【读文献】单细胞分析最佳实践 · Articles Docker 打包 Shiny App · Articles 部署预印本追踪 TRxiv 到 Github Action · Articles Hello, again · Articles 1 dataset 100 visualizations 中有意思的可视化 · Articles 论文可视化配色简易指南 · Articles Karabiner 助力,让你的键盘操作快人一步 · Articles 我的植物组学数据库合集 Ver.20220528 · Articles 利用 n8n 打造飞书 RSS 推送机器人 · Articles 「#」的前世今生 · Articles 克服低效率恐惧,回归健康生活 · Articles 科研论文作图基本知识 · Articles 为什么我们不喜欢学习 · Articles
解决远程服务器上Singularity联网问题 · Articles
2025-10-15 · via Yorksite

Home / Articles / Fix_singularity_connection_issue

Published Oct 15, 2025

2 minutes read

这几天遇到个项目,需要在服务器上用到 Nextflow 流程运行一个Singularity镜像(singleron-RD/wf-single-cell)虽然服务器能联网,但因为某些众所周知的原因,Singularity(或 Apptainer)完全无法从 DockerHub 直接拉取所需镜像。倒腾了一下午,试了各种办法,终于搞定了,这里记录下最终可行的解决方案。

背景

在服务器上运行某Nextflow流程时,需要从以下两个镜像拉取容器:

  • docker://ontresearch/wf-single-cell:sha0fcdf10929fbef2d426bb985e16b81153a88c6f4
  • docker://ontresearch/wf-common:sha91cd87900c86f05bf36d8c77b841b8fda5ecf3aa

但由于某些原因,所有 docker 系列的网站直连都打不开,直接拉取失败。

方案一:Mac上下载好镜像包再传给服务器(不可行)

一开始想在 Mac 上直接下载好镜像包,但是发现 M 系列芯片的 Mac 由于架构原因,并不支持直接安装 Singularity 或是 Apptainer。于是尝试在本地通过 Docker 启动一个运行 Apptainer 的环境再进行下载。

docker run -it --privileged \
  -v $PWD:/data \
  ghcr.io/apptainer/apptainer:latest bash
 
cd /data
 
apptainer pull ontresearch-wf-single-cell.sif docker://ontresearch/wf-single-cell:sha0fcdf10929fbef2d426bb985e16b81153a88c6f4
 
apptainer pull ontresearch-wf-common.sif       docker://ontresearch/wf-common:sha91cd87900c86f05bf36d8c77b841b8fda5ecf3aa

然而问题在于,Mac(ARM 架构)上生成的 .sif 文件无法在服务器(x86 架构)上运行,会报出架构不匹配错误,因此此方法虽然能成功获得 sif 文件,但获取的文件在服务器上无法运行。。


方案二:通过 SSH 代理转发使用本地代理下载(可行)

因为不想在服务器上单独配置一套代理,发现可以通过 SSH 反向端口转发,让服务器直接使用 Mac 本地代理,从而顺利下载容器镜像,实现流程如下:

1. 建立 SSH 反向代理通道

假设本地代理端口为 6152,在连接服务器时建立反向映射:

ssh -p 22 -R 1080:127.0.0.1:6152 usr_name@remote_ip -t zsh

连接成功后,服务器可以通过 127.0.0.1:1080 访问外网。

2. 在服务器上设置代理环境变量

export https_proxy=http://127.0.0.1:1080
export http_proxy=http://127.0.0.1:1080

3. 在服务器上准备镜像存放目录

mkdir -p $HOME/containers && cd $HOME/containers

4. 使用 Singularity 拉取镜像

singularity pull ontresearch-wf-single-cell.sif docker://ontresearch/wf-single-cell:sha0fcdf10929fbef2d426bb985e16b81153a88c6f4
singularity pull ontresearch-wf-common.sif       docker://ontresearch/wf-common:sha91cd87900c86f05bf36d8c77b841b8fda5ecf3aa

下载完成后,镜像文件保存在:

$HOME/containers/

5. 在 Nextflow 配置中使用本地 SIF 文件

为了避免 Nextflow 再次联网下载,可在 nextflow.config 中指定本地容器路径:

process {
  withLabel: singlecell {
    container = "$HOME/containers/ontresearch-wf-single-cell.sif"
  }
  withLabel: wf_common {
    container = "$HOME/containers/ontresearch-wf-common.sif"
  }
}

这样 Nextflow 会直接使用本地镜像文件,而不会再尝试从 DockerHub 获取。


五、总结

真是太费劲了!