-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lihongrui
committed
Oct 14, 2024
1 parent
f507a0e
commit 5988679
Showing
97 changed files
with
30,984 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,315 @@ | ||
<!DOCTYPE html> | ||
<html lang="zh-CN"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 6.2.0"> | ||
|
||
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png"> | ||
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png"> | ||
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png"> | ||
<link rel="mask-icon" href="/images/logo.svg" color="#222"> | ||
|
||
<link rel="stylesheet" href="/css/main.css"> | ||
|
||
|
||
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha256-HtsXJanqjKTc8vVQjO4YMhiqFoXkfBsjBWcX91T1jr8=" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous"> | ||
|
||
<script class="next-config" data-name="main" type="application/json">{"hostname":"gou7ma7.github.io","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.15.1","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":false,"style":null},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果:${query}","hits_time":"找到 ${hits} 个搜索结果(用时 ${time} 毫秒)","hits":"找到 ${hits} 个搜索结果"}}</script><script src="/js/config.js"></script> | ||
|
||
<meta name="description" content="installconnectsettingusagedocker container 互联背景: 我现在启动了n个container,他们之前需要通过端口互相访问,但是按照docker的默认网络模式,是会自己拉一个小局域网的,服务部署好了也访问不进去。 尝试1: 更改docker run --network=net模式,直接共享宿主机的网络,然后开心的发现 -p 暴露的端口没了,服务一样的无"> | ||
<meta property="og:type" content="article"> | ||
<meta property="og:title" content="use docker Q&A"> | ||
<meta property="og:url" content="https://gou7ma7.github.io/2022/05/29/install/docker-QA/index.html"> | ||
<meta property="og:site_name" content="业精于勤荒于嬉"> | ||
<meta property="og:description" content="installconnectsettingusagedocker container 互联背景: 我现在启动了n个container,他们之前需要通过端口互相访问,但是按照docker的默认网络模式,是会自己拉一个小局域网的,服务部署好了也访问不进去。 尝试1: 更改docker run --network=net模式,直接共享宿主机的网络,然后开心的发现 -p 暴露的端口没了,服务一样的无"> | ||
<meta property="og:locale" content="zh_CN"> | ||
<meta property="article:published_time" content="2022-05-29T00:48:59.000Z"> | ||
<meta property="article:modified_time" content="2024-10-11T07:40:28.385Z"> | ||
<meta property="article:author" content="Roy Lee"> | ||
<meta property="article:tag" content="linux"> | ||
<meta name="twitter:card" content="summary"> | ||
|
||
|
||
<link rel="canonical" href="https://gou7ma7.github.io/2022/05/29/install/docker-QA/"> | ||
|
||
|
||
|
||
<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://gou7ma7.github.io/2022/05/29/install/docker-QA/","path":"2022/05/29/install/docker-QA/","title":"use docker Q&A"}</script> | ||
|
||
<script class="next-config" data-name="calendar" type="application/json">""</script> | ||
<title>use docker Q&A | 业精于勤荒于嬉</title> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<noscript> | ||
<link rel="stylesheet" href="/css/noscript.css"> | ||
</noscript> | ||
</head> | ||
|
||
<body itemscope itemtype="http://schema.org/WebPage" class="use-motion"> | ||
<div class="headband"></div> | ||
|
||
<main class="main"> | ||
<div class="column"> | ||
<header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container"> | ||
<div class="site-nav-toggle"> | ||
<div class="toggle" aria-label="切换导航栏" role="button"> | ||
<span class="toggle-line"></span> | ||
<span class="toggle-line"></span> | ||
<span class="toggle-line"></span> | ||
</div> | ||
</div> | ||
|
||
<div class="site-meta"> | ||
|
||
<a href="/" class="brand" rel="start"> | ||
<i class="logo-line"></i> | ||
<p class="site-title">业精于勤荒于嬉</p> | ||
<i class="logo-line"></i> | ||
</a> | ||
</div> | ||
|
||
<div class="site-nav-right"> | ||
<div class="toggle popup-trigger" aria-label="搜索" role="button"> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
|
||
<nav class="site-nav"> | ||
<ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-github"><a href="https://github.com/gou7ma7" rel="section" target="_blank"><i class="fa fa-user fa-fw"></i>github</a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li><li class="menu-item menu-item-todo"><a href="https://gou7ma7.github.io/2022/05/29/TODO-LIST/" rel="section"><i class="fa fa-calendar fa-fw"></i>todo</a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li> | ||
</ul> | ||
</nav> | ||
|
||
|
||
|
||
|
||
</header> | ||
|
||
|
||
<aside class="sidebar"> | ||
|
||
<div class="sidebar-inner sidebar-nav-active sidebar-toc-active"> | ||
<ul class="sidebar-nav"> | ||
<li class="sidebar-nav-toc"> | ||
文章目录 | ||
</li> | ||
<li class="sidebar-nav-overview"> | ||
站点概览 | ||
</li> | ||
</ul> | ||
|
||
<div class="sidebar-panel-container"> | ||
<!--noindex--> | ||
<div class="post-toc-wrap sidebar-panel"> | ||
<div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#install"><span class="nav-number">1.</span> <span class="nav-text">install</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#connect"><span class="nav-number">2.</span> <span class="nav-text">connect</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#setting"><span class="nav-number">3.</span> <span class="nav-text">setting</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#usage"><span class="nav-number">4.</span> <span class="nav-text">usage</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#docker-container-%E4%BA%92%E8%81%94"><span class="nav-number">5.</span> <span class="nav-text">docker container 互联</span></a></li></ol></div> | ||
</div> | ||
<!--/noindex--> | ||
|
||
<div class="site-overview-wrap sidebar-panel"> | ||
<div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person"> | ||
<img class="site-author-image" itemprop="image" alt="Roy Lee" | ||
src="/images/avatar.png"> | ||
<p class="site-author-name" itemprop="name">Roy Lee</p> | ||
<div class="site-description" itemprop="description">AI时代,删除了无用的操作手册和业务经验,只留下目标和方向</div> | ||
</div> | ||
<div class="site-state-wrap animated"> | ||
<nav class="site-state"> | ||
<div class="site-state-item site-state-posts"> | ||
<a href="/archives/"> | ||
<span class="site-state-item-count">15</span> | ||
<span class="site-state-item-name">日志</span> | ||
</a> | ||
</div> | ||
<div class="site-state-item site-state-categories"> | ||
<a href="/categories/"> | ||
<span class="site-state-item-count">5</span> | ||
<span class="site-state-item-name">分类</span></a> | ||
</div> | ||
<div class="site-state-item site-state-tags"> | ||
<a href="/tags/"> | ||
<span class="site-state-item-count">11</span> | ||
<span class="site-state-item-name">标签</span></a> | ||
</div> | ||
</nav> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
</aside> | ||
|
||
|
||
</div> | ||
|
||
<div class="main-inner post posts-expand"> | ||
|
||
|
||
|
||
|
||
|
||
<div class="post-block"> | ||
|
||
|
||
|
||
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN"> | ||
<link itemprop="mainEntityOfPage" href="https://gou7ma7.github.io/2022/05/29/install/docker-QA/"> | ||
|
||
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person"> | ||
<meta itemprop="image" content="/images/avatar.png"> | ||
<meta itemprop="name" content="Roy Lee"> | ||
</span> | ||
|
||
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization"> | ||
<meta itemprop="name" content="业精于勤荒于嬉"> | ||
<meta itemprop="description" content="AI时代,删除了无用的操作手册和业务经验,只留下目标和方向"> | ||
</span> | ||
|
||
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork"> | ||
<meta itemprop="name" content="use docker Q&A | 业精于勤荒于嬉"> | ||
<meta itemprop="description" content=""> | ||
</span> | ||
<header class="post-header"> | ||
<h1 class="post-title" itemprop="name headline"> | ||
use docker Q&A | ||
</h1> | ||
|
||
<div class="post-meta-container"> | ||
<div class="post-meta"> | ||
<span class="post-meta-item"> | ||
<span class="post-meta-item-icon"> | ||
<i class="far fa-calendar"></i> | ||
</span> | ||
<span class="post-meta-item-text">发表于</span> | ||
|
||
<time title="创建时间:2022-05-29 08:48:59" itemprop="dateCreated datePublished" datetime="2022-05-29T08:48:59+08:00">2022-05-29</time> | ||
</span> | ||
<span class="post-meta-item"> | ||
<span class="post-meta-item-icon"> | ||
<i class="far fa-calendar-check"></i> | ||
</span> | ||
<span class="post-meta-item-text">更新于</span> | ||
<time title="修改时间:2024-10-11 15:40:28" itemprop="dateModified" datetime="2024-10-11T15:40:28+08:00">2024-10-11</time> | ||
</span> | ||
<span class="post-meta-item"> | ||
<span class="post-meta-item-icon"> | ||
<i class="far fa-folder"></i> | ||
</span> | ||
<span class="post-meta-item-text">分类于</span> | ||
<span itemprop="about" itemscope itemtype="http://schema.org/Thing"> | ||
<a href="/categories/Install/" itemprop="url" rel="index"><span itemprop="name">Install</span></a> | ||
</span> | ||
</span> | ||
|
||
|
||
</div> | ||
|
||
</div> | ||
</header> | ||
|
||
|
||
|
||
|
||
<div class="post-body" itemprop="articleBody"><span id="more"></span> | ||
|
||
<h1 id="install"><a href="#install" class="headerlink" title="install"></a>install</h1><h1 id="connect"><a href="#connect" class="headerlink" title="connect"></a>connect</h1><h1 id="setting"><a href="#setting" class="headerlink" title="setting"></a>setting</h1><h1 id="usage"><a href="#usage" class="headerlink" title="usage"></a>usage</h1><h1 id="docker-container-互联"><a href="#docker-container-互联" class="headerlink" title="docker container 互联"></a>docker container 互联</h1><p>背景: 我现在启动了n个container,他们之前需要通过端口互相访问,但是按照docker的默认网络模式,是会自己拉一个小局域网的,服务部署好了也访问不进去。</p> | ||
<p>尝试1: 更改<code>docker run --network=net</code>模式,直接共享宿主机的网络,然后开心的发现 -p 暴露的端口没了,服务一样的无法被访问了。</p> | ||
<p>尝试2: 改用<code>docker run --link=container1</code>互相关联起来,然后可以ping了,但是发现通过端口访问container1的服务还是不行,后来发现互联和端口能访问是两个东西。。。然后灵光一闪,把container1别名设置成<code>localhost</code>然后就能访问了。。。</p> | ||
<p>正确做法: 使用docker-compose进行编排啊,想暴露什么端口暴露什么端口,哦豁,这下要提前看docker的东西了。</p> | ||
|
||
</div> | ||
|
||
|
||
|
||
|
||
|
||
<footer class="post-footer"> | ||
<div class="post-tags"> | ||
<a href="/tags/linux/" rel="tag"># linux</a> | ||
</div> | ||
|
||
|
||
|
||
<div class="post-nav"> | ||
<div class="post-nav-item"> | ||
<a href="/2022/05/29/install/linux-QA/" rel="prev" title="use linux Q&A"> | ||
<i class="fa fa-chevron-left"></i> use linux Q&A | ||
</a> | ||
</div> | ||
<div class="post-nav-item"> | ||
<a href="/2022/05/29/leetcode/yield%E4%B8%8E%E4%BA%8C%E5%8F%89%E6%A0%91%E9%81%8D%E5%8E%86/" rel="next" title="从二叉树遍历到yield"> | ||
从二叉树遍历到yield <i class="fa fa-chevron-right"></i> | ||
</a> | ||
</div> | ||
</div> | ||
</footer> | ||
</article> | ||
</div> | ||
|
||
|
||
|
||
|
||
|
||
|
||
</div> | ||
</main> | ||
|
||
<footer class="footer"> | ||
<div class="footer-inner"> | ||
|
||
|
||
<div class="copyright"> | ||
© | ||
<span itemprop="copyrightYear">2024</span> | ||
<span class="with-love"> | ||
<i class="fa fa-heart"></i> | ||
</span> | ||
<span class="author" itemprop="copyrightHolder">Roy Lee</span> | ||
</div> | ||
<div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动 | ||
</div> | ||
|
||
</div> | ||
</footer> | ||
|
||
|
||
<div class="back-to-top" role="button" aria-label="返回顶部"> | ||
<i class="fa fa-arrow-up fa-lg"></i> | ||
<span>0%</span> | ||
</div> | ||
|
||
<noscript> | ||
<div class="noscript-warning">Theme NexT works best with JavaScript enabled</div> | ||
</noscript> | ||
|
||
|
||
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script> | ||
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</body> | ||
</html> |
Oops, something went wrong.