docker 的实践操作
查看版本信息
[root@k8s-1 ~]# docker version
Client:
Version: 18.09.6
API version: 1.39
Go version: go1.10.8
Git commit: 481bc77156
Built: Sat May 4 02:34:58 2019
OS/Arch: linux/amd64
Experimental: false Server: Docker Engine - Community
Engine:
Version: 18.09.7
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: 2d0083d
Built: Thu Jun 27 17:26:28 2019
OS/Arch: linux/amd64
Experimental: false
查看帮助
Flag shorthand -h has been deprecated, please use --help Usage: docker [OPTIONS] COMMAND A self-sufficient runtime for containers Options:
--config string Location of client config files (default "/root/.docker")
-D, --debug Enable debug mode
-H, --host list Daemon socket(s) to connect to
-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default "/root/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default "/root/.docker/cert.pem")
--tlskey string Path to TLS key file (default "/root/.docker/key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit Management Commands: 最新版本命令分组
builder Manage builds
config Manage Docker configs
container Manage containers
engine Manage the docker engine
image Manage images
network Manage networks
node Manage Swarm nodes
plugin Manage plugins
secret Manage Docker secrets
service Manage services
stack Manage Docker stacks
swarm Manage Swarm
system Manage Docker
trust Manage trust on Docker images
volume Manage volumes Commands:
attach Attach local standard input, output, and error streams to a running container
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes to files or directories on a container's filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on Docker objects
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
login Log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart one or more containers
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save one or more images to a tar archive (streamed to STDOUT by default)
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
version Show the Docker version information
wait Block until one or more containers stop, then print their exit codes Run 'docker COMMAND --help' for more information on a command.
查看docker信息;https://www.cnblogs.com/rdchenxi/p/10674479.html 存储驱动相关信息
[root@k8s-1 ~]# docker info
Containers: 0 所有容器
Running: 0 运行状态的容器
Paused: 0 暂停状态
Stopped: 0 停止状态
Images: 0 容器镜像的个数
Server Version: 18.09.7 版本
Storage Driver: overlay2 存储驱动
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-957.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.683GiB
Name: k8s-1
ID: JIYY:UFEX:ANGL:JOPR:VKFT:V6HG:LRY7:KWUY:36KV:JSAK:U7QY:54YF
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
http://f1361db2.m.daocloud.io/
Live Restore Enabled: false
Product License: Community Engine WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
搜索镜像
[root@k8s-1 ~]# docker search nginx
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. 11654 [OK]
jwilder/nginx-proxy Automated Nginx reverse proxy for docker con… 1623 [OK]
richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable of… 724 [OK]
bitnami/nginx Bitnami nginx Docker Image 68 [OK]
linuxserver/nginx An Nginx container, brought to you by LinuxS… 65
tiangolo/nginx-rtmp Docker image with Nginx using the nginx-rtmp… 48 [OK]
nginx/nginx-ingress NGINX Ingress Controller for Kubernetes 20
nginxdemos/hello NGINX webserver that serves a simple page co… 17 [OK]
schmunk42/nginx-redirect A very simple container to redirect HTTP tra… 17 [OK]
jlesage/nginx-proxy-manager Docker container for Nginx Proxy Manager 16 [OK]
crunchgeek/nginx-pagespeed Nginx with PageSpeed + GEO IP + VTS + more_s… 13
blacklabelops/nginx Dockerized Nginx Reverse Proxy Server. 12 [OK]
centos/nginx-18-centos7 Platform for running nginx 1.8 or building n… 11
centos/nginx-112-centos7 Platform for running nginx 1.12 or building … 9
webdevops/nginx Nginx container 8 [OK]
nginxinc/nginx-unprivileged Unprivileged NGINX Dockerfiles 7
sophos/nginx-vts-exporter Simple server that scrapes Nginx vts stats a… 5 [OK]
1science/nginx Nginx Docker images that include Consul Temp… 4 [OK]
nginx/nginx-prometheus-exporter NGINX Prometheus Exporter 4
mailu/nginx Mailu nginx frontend 3 [OK]
travix/nginx NGinx reverse proxy 2 [OK]
pebbletech/nginx-proxy nginx-proxy sets up a container running ngin… 2 [OK]
wodby/nginx Generic nginx 0 [OK]
ansibleplaybookbundle/nginx-apb An APB to deploy NGINX 0 [OK]
centos/nginx-110-centos7 Platform for running nginx 1.10 or building … 0
下载镜像操作
[root@k8s-1 ~]# docker pull centos # 镜像下载
Using default tag: latest
latest: Pulling from library/centos
8ba884070f61: Pull complete
Digest: sha256:ca58fe458b8d94bc6e3072f1cfbd334855858e05e1fd633aa07cf7f82b048e66
Status: Downloaded newer image for centos:latest
[root@k8s-1 ~]# docker image pull tomcat #镜像下载
Using default tag: latest
latest: Pulling from library/tomcat
6f2f362378c5: Pull complete
494c27a8a6b8: Pull complete
7596bb83081b: Pull complete
372744b62d49: Pull complete
fb72767f9beb: Pull complete
3fe571af508a: Pull complete
3e6725074325: Pull complete
9ffd5dadda90: Pull complete
846896c59095: Pull complete
cfe9a252095d: Pull complete
Digest: sha256:fdc521aa1113dc07e386fa55e69670b76130a7d9490094acd52e9d4f4218e9e1
Status: Downloaded newer image for tomcat:latest
查看本机镜像
[root@k8s-1 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
tomcat latest 7123ec940c88 2 days ago 510MB
nginx latest f68d6e55e065 4 days ago 109MB
centos latest 9f38484d220f 3 months ago 202MB
[root@k8s-1 ~]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
tomcat latest 7123ec940c88 2 days ago 510MB
nginx latest f68d6e55e065 4 days ago 109MB
centos latest 9f38484d220f 3 months ago 202MB
删除镜像
[root@k8s-1 ~]# docker image rm centos
Untagged: centos:latest
Untagged: centos@sha256:ca58fe458b8d94bc6e3072f1cfbd334855858e05e1fd633aa07cf7f82b048e66
Deleted: sha256:9f38484d220fa527b1fb19747638497179500a1bed8bf0498eb788229229e6e1
Deleted: sha256:d69483a6face4499acb974449d1303591fcbb5cdce5420f36f8a6607bda11854
[root@k8s-1 ~]# docker rmi nginx:latest
Untagged: nginx:latest
Untagged: nginx@sha256:3abaed99ee6cb6140cb10110422cf1ece83c49ad63f7c27708994fceda565e80
Deleted: sha256:f68d6e55e06520f152403e6d96d0de5c9790a89b4cfc99f4626f68146fa1dbdc
Deleted: sha256:1b0c768769e2bb66e74a205317ba531473781a78b77feef8ea6fd7be7f4044e1
Deleted: sha256:34138fb60020a180e512485fb96fd42e286fb0d86cf1fa2506b11ff6b945b03f
Deleted: sha256:cf5b3c6798f77b1f78bf4e297b27cfa5b6caa982f04caeb5de7d13c255fd7a1e
[root@k8s-1 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
tomcat latest 7123ec940c88 2 days ago 510MB
容器的操作
[root@k8s-1 ~]# docker container Usage: docker container COMMAND Manage containers Commands:
attach Attach local standard input, output, and error streams to a running container
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes to files or directories on a container's filesystem
exec Run a command in a running container
export Export a container's filesystem as a tar archive
inspect Display detailed information on one or more containers
kill Kill one or more running containers
logs Fetch the logs of a container
ls List containers
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
prune Remove all stopped containers
rename Rename a container
restart Restart one or more containers
rm Remove one or more containers
run Run a command in a new container
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
wait Block until one or more containers stop, then print their exit codes Run 'docker container COMMAND --help' for more information on a command.
查看本机容器
[root@k8s-1 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@k8s-1 ~]# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
启动一个容器
[root@k8s-1 ~]# docker run --name b1 -it busybox # 交互进入
/ #
查看本机docker网络
[root@k8s-1 ~]# docker network ls
NETWORK ID NAME DRIVER SCOPE
62a3329169cf bridge bridge local
fe7f27a4396a host host local
d72117fcea57 none null local
查看容器日志
[root@k8s-1 ~]# docker container logs nginx
docker 的实践操作的更多相关文章
- 【实战】Docker入门实践二:Docker服务基本操作 和 测试Hello World
操作环境 操作系统:CentOS7.2 内存:1GB CPU:2核 Docker服务常用命令 docker服务操作命令如下 service docker start #启动服务 service doc ...
- Docker 容器高级操作[Docker 系列-3]
关注公众号,大家可以在公众号后台回复“博客园”,免费获得作者 Java 知识体系/面试必看资料. 上篇文章向读者介绍了一个 Nginx 的例子,对于 Nginx 这样一个容器而言,当它启动成功后,我们 ...
- kmeans算法原理以及实践操作(多种k值确定以及如何选取初始点方法)
kmeans一般在数据分析前期使用,选取适当的k,将数据聚类后,然后研究不同聚类下数据的特点. 算法原理: (1) 随机选取k个中心点: (2) 在第j次迭代中,对于每个样本点,选取最近的中心点,归为 ...
- 关于 Docker 镜像的操作,看完这篇就够啦 !(下)
紧接着上篇<关于 Docker 镜像的操作,看完这篇就够啦 !(上)>,奉上下篇 !!! 镜像作为 Docker 三大核心概念中最重要的一个关键词,它有很多操作,是您想学习容器技术不得不掌 ...
- Docker入门 - 002 Docker 的简单操作
系统要求:CentOS 7.2 64 位操作系统. Docker 的简单操作 下载镜像 下载一个官方的 CentOS 镜像到本地 docker pull centos 下载好的镜像就会出现在镜像列表里 ...
- docker简易实践
docker简易实践 实验环境 操作系统:deepin 15.4 安装步骤 1.安装docker sudo apt-get install docker.io 2.启动docker服务 sudo se ...
- 这是一次 docker 入门实践
前言 其实接触 docker 也有一段时间了,但是一直没有做下总结,现在网上关于 docker 的介绍也有很多了,本着好记性不如烂笔头的原则,还是自己再记录一波吧. 实现目标 安装 docker ce ...
- docker最佳实践-----美团点评的分享
美团点评容器平台简介 本文介绍美团点评的Docker容器集群管理平台(以下简称“容器平台”).该平台始于2015年,是基于美团云的基础架构和组件而开发的Docker容器集群管理平台.目前该平台为美团点 ...
- Jasperreport+ireport 实践操作及web应用
Jasperreport+ireport 实践操作及web应用 学习完jasperreports+ireport,给我感觉深刻,不仅掌握了报表开发技术,还掌握了怎样在web中生成pdf,xls,r ...
随机推荐
- oracle-数据库被注入恶意攻击程序的案例恢复
问题描述: Oracle数据库由于重启之后无法正常启动,tab$被清空(ORA-600 16703故障解析—tab$表被清空),导致数据库启动异常 ORA-600 16703报错 一.检测方法: 如下 ...
- 【 SSH 整合】Spring、Struts、Hibernate基本整合
applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xm ...
- 一个c程序的执行是从什么开始的?
一个C语言的执行是从本程序的main函数开始,到main函数结束,但需要注意的是,也是有特殊情况的,若是代码中出现了exit函数,则直接结束程序,对于这一点还是需要了解的. 关于c语言需要了解的是,C ...
- 每天进步一点点------FPGA 静态时序分析模型——reg2reg
2. 应用背景 静态时序分析简称STA,它是一种穷尽的分析方法,它按照同步电路设计的要求,根据电路网表的拓扑结构,计算并检查电路中每一个DFF(触发器)的建立和保持时间以及其他基于路径的时延要求是否满 ...
- LA 2995 立方体成像(模拟)
题目链接:https://vjudge.net/problem/UVALive-2995 这道题的主要难点在于三维坐标系的建立,然后在坐标系中进行迭代更新. 注意用宏定义来简化代码. AC代码: #i ...
- 分布式系统:CAP 理论的前世今生
CAP 理论是分布式系统设计中的一个重要理论,虽然它为系统设计提供了非常有用的依据,但是也带来了很多误解.本文将从 CAP 诞生的背景说起,然后对理论进行解释,最后对 CAP 在当前背景下的一些新理解 ...
- OGG在windows环境下字符集的配置
windows环境下不配置字符集(默认使用windows自己的字符集),从linux等系统同步过来的表中如果含有中文字符列将显示为乱码,被ogg误认为虚拟列,从而导致进程abend. 设置ogg进程在 ...
- Spring Boot 编辑器 IDEA 免费许可申请
最近 IDEA 陆续到期(试用版)听说可以申请开源许可,试试吧. 点击 https://www.jetbrains.com/shop/eform/opensource?product=ALL 填写相关 ...
- 一组关于{x}的积分
\[\Large\displaystyle \int_{0}^{1}\left \{ \frac{1}{x} \right \}\mathrm{d}x~,~\int_{0}^{1}\left \{ \ ...
- 《实战Java高并发程序设计》读书笔记三
第三章 JDK并发包 1.同步控制 重入锁:重入锁使用java.util.concurrent.locks.ReentrantLock类来实现,这种锁可以反复使用所以叫重入锁. 重入锁和synchro ...