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

推荐订阅源

L
LINUX DO - 最新话题
C
Cyber Attacks, Cyber Crime and Cyber Security
G
GRAHAM CLULEY
T
Tenable Blog
T
Threatpost
C
CXSECURITY Database RSS Feed - CXSecurity.com
I
Intezer
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
Darknet – Hacking Tools, Hacker News & Cyber Security
K
Kaspersky official blog
Security Latest
Security Latest
P
Privacy & Cybersecurity Law Blog
Google Online Security Blog
Google Online Security Blog
SecWiki News
SecWiki News
P
Palo Alto Networks Blog
TaoSecurity Blog
TaoSecurity Blog
Webroot Blog
Webroot Blog
Spread Privacy
Spread Privacy
O
OpenAI News
The Last Watchdog
The Last Watchdog
P
Proofpoint News Feed
C
Check Point Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
人人都是产品经理
人人都是产品经理
S
Security @ Cisco Blogs
Scott Helme
Scott Helme
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
月光博客
月光博客
S
Securelist
酷 壳 – CoolShell
酷 壳 – CoolShell
V
V2EX
T
Troy Hunt's Blog
W
WeLiveSecurity
GbyAI
GbyAI
N
News | PayPal Newsroom
Y
Y Combinator Blog
C
Cisco Blogs
H
Help Net Security
The GitHub Blog
The GitHub Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 【当耐特】
Jina AI
Jina AI
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
云风的 BLOG
云风的 BLOG
小众软件
小众软件
N
News and Events Feed by Topic

jdhao's digital space

Conversion between base64 and OpenCV or PIL Image 腾讯云对象存储博客图床开启 CDN 加速(不需要购买额外域名) Search and Replace in Multiple Files in Vim/Neovim Change Table Column Width in LaTeX Image or Table Side by Side in LaTeX LaTeX 并排显示图像或表格 Firenvim: Neovim inside Your Browser Content inside HTML tags missing in Latest Hugo? Creating Markdown Front Matter with Ultisnips Labelme JSON 标注格式转 voc XML 格式 Nifty Nvim Techniques That Make My Life Easier -- Series 6 macOS 下如何为视频制作字幕 Running Command Asynchronously inside Neovim Resolving Merge Conflict after Git Stash Pop Pylint: command not found? A Hands-on Experience with Neovim's Built-in LSP Support How to Convert PDF to Images with Imagemagick 互联网上常用缩略语集锦 File Backup in Neovim Converting PDF Pages to Images with Poppler Nifty Nvim Techniques That Make My Life Easier -- Series 5 Neovim Configuration for System-wide Use How to sort a list of tuple or list in Python -- lambda or itemgetter? Building A Vim Statusline from Scratch 人类第一颗原子弹爆炸始末 Distributed Training in PyTorch with Horovod Learning Expect Programming Essential Knowledge about SSH Nifty LaTeX Techniques -- Series 1 更改 Adsense 邮寄地址,重新寄送 PIN Mintty Tips and Configurations Generating Table of Contents for Markdown with Tagbar Convert Python Script to Exe on Windows with Pyinstaller Ubuntu on Windows Missing after Windows Update 使用代理加速 Mac 终端下载速度 My Experience with Several Zsh Plugin Managers 深圳租房小记 How to Install zplug inside Docker Container Why don't settings inside bashrc or bash_profile take effect? Setting Up Locale in Linux 谷歌 Adsense 申请及在 Hugo 中的配置 How to Write Algorithm Pseudo Code in LaTeX Nifty Nvim Techniques That Make My Life Easier -- Series 4 A Few Grammar Questions in Writing How to Read and Write Images with Unicode Paths in OpenCV Creating A Professional Table in LaTeX with booktabs How to Create Proper Folding for Vim/Nvim Configuration Linux Tips and Tricks -- s1 JPEG Image Orientation and Exif How Do I Show the Current File Path In Neovim? JPEG Image Quality in PIL Difference between view, reshape, transpose and permute in PyTorch Convert PIL or OpenCV Image to Bytes without Saving to Disk Fast Movement and Navigation Inside Vim or Neovim Unintuitive Behaviour of Case Sensitivity in Python glob Binding Keys in Zsh 几把机械键盘试用体验 Nvim Autocompletion with Deoplete Converting Markdown to Beautiful PDF with Pandoc Exclusive and Inclusive Motion in Neovim/Vim Nifty Nvim Techniques Which Make My Life Easier -- Series 3 Why Doesn't Jedi Autocompletion Work for Some Methods Vim-like Editing inside Browser Markdown 生成 HTML 时汉字之间出现多余空格问题 小米 9 安装谷歌商店(Google Play Store)与相关配置 Create Mappings That Take A Count in Neovim Spell Checking in Nvim English Words Completion inside Neovim/Vim How to Use Python Inside Vim Script with Neovim Nifty Little Nvim Techniques to Make My Life Easier -- Series 2 Setting up Ultisnips for Neovim Mac 上罗技 M590 鼠标设置 Nifty Little Nvim Techniques to Make My Life Easier -- Series 1 A Complete Guide on Writing LaTeX with Vimtex in Neovim Manipulating Images with Alpha Channels in Pillow Sublime Text Regular Expression Cheat Sheet Cropping Rotated Rectangles from Image with OpenCV Boosting Your Productivity on Terminal with Zsh and Plugins 最新版 Rime 输入法使用 (2022 更新) Display Image with Pillow inside Ubuntu on Windows Faster Directory Navigation with z.lua Cmder Advanced Configurations Nvim-qt Settings on Windows 10 Tmux Plugin Install and Management How to Debug Python Code in Terminal Markdown Writing and Previewing in Neovim -- A Complete Guide Line Number Settings for More Efficient Movement in Neovim 两个大规模中文语料库介绍以及处理 Windows 系统下几款程序员不可不用的神器 我的 2018 阅读清单 A Complete Guide to Neovim Configuration for Python Development How Is Newline Handled in Python and Various Editors? Two Issues Related to ImageFont Module in PIL 在 Listary 中调用 GoldenDict 或欧路词典查单词 Reading and Writing Text Files on Windows The Mathematics behind Font Shapes --- Bézier Curves and More 快速识别图片字体:字体识别工具介绍 Deoplete Failed to Load at Startup after Updating Python neovim Package What Is The Difference between pip, pip3 and pip3.6 Shipped with Anaconda3? Windows 10 系统下 Neovim 安装与配置
Docker 学习系列 --- 1
2020-05-02 · via jdhao's digital space

Docker 是一种类似虚拟机的机制,允许我们在 host 机器创建一个隔绝的小型操作系统环境,并且可以保存下这个环境(称为 Docker 镜像),把这个 Docker 镜像部署到其他 host 机器,各个机器上的环境完全一致。这样我们就不需要每次在部署新环境的时候,重复执行安装程序、配置环境的流程,大大简化了我们的工作,提升了工作效率。

Docker 镜像就像一个小的操作系统,从哪里获取我们需要的 Docker 镜像呢? Docker hub 是 Docker 官方提供的镜像托管仓库,里面包含了很多用户上传的镜像。docker hub 上的镜像,可以直接使用 docker run 命令来运行镜像,不需要 docker pull,然后再 docker run。如果运行一个镜像不在本地,docker 会尝试从 docker hub 下载这个镜像,然后再运行。

镜像容器 两个概念有什么区别?#

可以简单认为,镜像是死的,是冻结的容器,镜像实例化运行以后,就是容器,所以从一个镜像可以运行多个容器,这些容器初始状态都是完全一样的。镜像和容器的关系,类似于编程中 ”类“ 和 ”对象“ 的关系。

参考#

如何退出当前运行的 docker 容器#

如果以 -t 方式运行容器,那么可以使用 ctrl-p 然后 ctrl-q 挂起容器,后续可以再使用 attach 命令进入容器,参考这里

重新进入正在运行的容器?#

当容器以交互式方式运行 (-i) 时,可以在多个地方连接到这个容器,查看容器的内容,连接到正在运行的容器的命令是:

docker attach CONTAINER_ID

此时在一个地方输入指令,其他地方也会同时显示相同的指令和输出结果。

列出系统上正在运行的运行#

要列出系统上目前正在运行的容器:

停止容器运行#

要停止一个正在运行的 container,使用

container 运行退出以后,不会自动删除,还在系统上,需要重启的时候可以使用(参考 这里)

docker start -ai CONTAINER_ID

删除容器#

如果需要删除某个 container,可以使用(参考这里)

Cuda Dockerfile 资源#

英伟达官方提供了大量的含有 Cuda 环境的 Dockerfile 资源,地址如下:

https://gitlab.com/nvidia/container-images/cuda

包含了各个系统以及各个版本的 cuda。如果要构建使用英伟达显卡的镜像,可以使用这些镜像中的一个作为基础镜像。

Docker 镜像构建重要心得#

我们可以使用 Dockerfile 来构建 Docker 镜像,Dockerfile 相当于是构建镜像的模版。构建镜像最令人烦躁的问题就是在构建过程中突然出错,我们不得不一次次修改 Dockerfile,解决各种问题。所以构建 Docker 镜像的一个重要心得就是:尽量防止 build 出错。

我们构建镜像的时候,一般会从一个基础镜像开始构建,由于基础镜像通常执行的是最小安装[^1],很多常用工具并没有安装,所以镜像 build 过程中,经常因为没有安装一些库而中途出错。一个好的方法是开两个 terminal 窗口,一个窗口,可以先 docker run 进入基础镜像的容器,然后在容器里面一步一步运行想要执行的操作,如果在基础镜像里面运行没有错误,在另外一个 terminal 窗口,把这些操作写到 Dockerfile;如果在基础镜像里面运行某个命令有错误,那么解决这个错误,把需要添加的库或者需要执行的命令补充到 Dockerfile 里面。

按照上面这个步骤来建立 Dockerfile,可以极大减少出错的机会。