docker学习笔记1 -- 安装和配置
技术资料
docker中文官网:http://www.docker.org.cn/
中文入门课程:http://www.docker.org.cn/book/docker.html
docker学习笔记:http://www.open-open.com/lib/view/open1423703640748.html
深入浅出docker:http://www.infoq.com/cn/articles/docker-core-technology-preview
安装
参考:http://www.docker.org.cn/book/install/install-docker-on-rhel-29.html
配置
在centos7中,docker的默认配置在/usr/lib/systemd/system/docker.service,可以做一些配置:
- --insecure-registry 127.0.0.1:5000 Docker 1.3版本后,与registry交互默认使用https,配置后表示跟该仓库交互形式为http
使用
search
docker search --help Usage: docker search [OPTIONS] TERM Search the Docker Hub for images --automated=false Only show automated builds
--help=false Print usage
--no-trunc=false Don't truncate output
-s, --stars=0 Only displays with at least x stars
如果要搜索非docker hub上的镜像,可以增加仓库地址
pull
docker pull --help Usage: docker pull [OPTIONS] NAME[:TAG|@DIGEST] Pull an image or a repository from the registry -a, --all-tags=false Download all tagged images in the repository
--help=false Print usage
在下载的时候,可以使用TAG,默认下载的是latest,默认是从docker hub上下载,如果要从docker hub的个人仓库中下载,需要加上个人账号前缀
docker pull sailor/mycentos
从docker hub的sailor用户仓库上下载mycentos镜像
也可以显示指定不从docker hub上下载,比如
docker pull dl.dockerpool.com:5000/centos
表示从dl.dockerpool.com:5000上下载centos镜像
run
docker run --help Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...] Run a command in a new container -a, --attach=[] Attach to STDIN, STDOUT or STDERR
--add-host=[] Add a custom host-to-IP mapping (host:ip)
--blkio-weight=0 Block IO (relative weight), between 10 and 1000
-c, --cpu-shares=0 CPU shares (relative weight)
--cpuset-cpus= CPUs in which to allow execution (0-3, 0,1)
--cpuset-mems= MEMs in which to allow execution (0-3, 0,1)
-d, --detach=false Run container in background and print container ID
...
...
docker run参数很多,包括指定容器运行资源(CPU/MEM等),以及一些其它参数,常用:
docker run -t -i centos /bin/bash
-t表示启动一个tty(控制台), -i表示开启stdin输出,/bin/bash表示在镜像中执行/bin/bash命令
commit
当对镜像做了修改后,想重新提交的时候,需要用到commit命令
docker commit --help Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]] Create a new image from a container's changes -a, --author= Author (e.g., "John Hannibal Smith <hannibal@a-team.com>")
-c, --change=[] Apply Dockerfile instruction to the created image
--help=false Print usage
-m, --message= Commit message
-p, --pause=true Pause container during commit
push
参考:http://blog.chinaunix.net/uid-20788636-id-5049772.html
- 在docker hub中注册一个账户,比如注册账户为sailor
- 在本机进行docker login,需要填写参数:username password email等
- 将原来的镜像打标签成 {username}/xxx,比如讲centos镜像通过打标签成 sailor/mycentos
- 使用docker push将其发布到docker hub的sailor账户的仓库中
docker学习笔记1 -- 安装和配置的更多相关文章
- Docker学习笔记之--安装mssql(Sql Server)并使用Navicat连接测试(环境:centos7)
前一节演示如何使用Nginx反向代理 .net Core项目容器,地址:Docker学习笔记之-部署.Net Core 3.1项目到Docker容器,并使用Nginx反向代理(CentOS7)(二) ...
- docker学习笔记(二)--配置镜像加速器
前提:docker已经安装好 配置过程 进入至阿里云开发中心,https://dev.aliyun.com/,点击管理中心 管理中心中,点击左侧镜像加速器. 修改配置文件,使用加速器,根据我们目前Do ...
- Docker学习:virtualbox安装和配置
下载.安装 从官网:https://www.virtualbox.org/下载,根据说明直接一步步安装即可 安装ubuntu 说明:这里本机内存是16G,若内存<4G安装完成虚拟机, 安装完成之 ...
- Vue学习笔记-VSCode安装与配置
一 使用环境: windows 7 64位操作系统 二 VSCode安装与配置 1.下载: https://code.visualstudio.com 直接点击即可. 2. 点击按装程序,默认安 ...
- Docker学习笔记之为容器配置网络
0x00 概述 在互联网时代,网络已经成为绝大多数应用进行数据交换的主要通道,Docker 作为集群部署的利器,在网络支持上也下了许多功夫.功能丰富和强大,并不代表使用复杂,在 Docker 的封装下 ...
- Docker学习笔记_安装和使用Zookeeper
一.准备 1.宿主机OS:Win10 64位 2.虚拟机OS:Ubuntu18.04 3.账号:docker 二.安装 1.搜索镜像 ...
- MongoDB学习笔记——数据库安装及配置
MongoDB数据库安装 MongoDB官方下载地址:https://www.mongodb.com/download-center 首先需要根据Windows版本选择正确的MongoDB版本进行安装 ...
- Docker学习笔记-Redis 安装
拉取官方的镜像 docker pull redis:3.2 查看 docker images redis 运行容器 docker run -p 6379:6379 -v $PWD/data:/data ...
- cakephp2.7的学习笔记1 —— 安装与配置
CakePHP2.7的安装 下载 https://github.com/cakephp/cakephp/releases 解压后扔进你的www目录就可以直接访问 按照提示,修改这两项配置,替换成你喜欢 ...
随机推荐
- 25. Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If ...
- MyEclipse9中的不伤眼修改、FreeMarker插件、JQuery提示插件、全屏(FullScreen)插件的安装
============下载相关附件===================== http://files.cnblogs.com/fhtwins/eclipse-fullscreen_1.0.7.zi ...
- adb上使用cp/mv命令的替代方法(failed on '***' - Cross-device link解决方法)
今天把玩手头的那部Android手机时碰到一个问题,即因为权限问题无法将文件复制到/system/和/data/分区中,经过一番折腾后,算是解决了,在此记录一笔.本方所涉及到的命令输入,均用斜体字表示 ...
- OC知识点
1.@autoreleasepool why1 2.retain O-C内存管理和点语法1>OC内存管理正常情况要使用大量的retain和relrese操作2>点语法可以减少使用retai ...
- Segment fault及LINUX core dump详解
源自:http://andyniu.iteye.com/blog/1965571 core dump的概念: A core dump is the recorded state of the work ...
- PO_PO系列 - 收货管理分析(案例)
2014-07-01 Created By BaoXinjian
- 基于redis的分布式锁
<?php /** * 基于redis的分布式锁 * * 参考开源代码: * http://nleach.com/post/31299575840/redis-mutex-in-php * * ...
- 转 -android:程序无响应,你该如何定位问题?
如果MainThread长时间无响应,系统会提示“XXX无响应”,然后用户会关闭.那么,如何定位问题呢?无响应并不像Crash,它抓取不到异常日志,通常我们需要调试,才能定位问题.如何调试呢? 1.在 ...
- UCOS-消息队列(学习笔记)
消息队列的核心是一个消息的指针数组,UCOS系统初始化时根据OS_CONFI.h中的最大队列个数定义这么多个消息队列(队列的结构)并将他们串联成空的链表,创建消息队列时从空链表中抽出一个并用指针数组的 ...
- js 回车提交表单的实现
我们有时候希望回车键敲在文本框(input element)里来提交表单(form),但有时候又不希望如此.比如搜索行为,希望输入完关键词之后直接按回车键立即提交表单,而有些复杂表单,可能要避免回车键 ...