# 容器虚拟机
# Flag
- https://github.com/topics/cloudnative (opens new window)
- https://github.com/topics/openstack (opens new window)
- https://github.com/docker (opens new window)
- https://github.com/boot2docker (opens new window)
- https://github.com/portainer/portainer (opens new window)
- 利用Docker实现后台项目模板化配置部署 (opens new window)
- https://github.com/earthly/earthly (opens new window)
- https://github.com/StefanScherer/docker-cli-builder (opens new window)
- https://github.com/skanehira/docui (opens new window)
- https://github.com/jesseduffield/lazydocker (opens new window)
- GUI https://github.com/DockStation/dockstation (opens new window)
- https://github.com/dockur/windows (opens new window)
- Docker进阶实用命令 (opens new window)
- https://sleele.com/category/docker/ (opens new window)
- https://docs.microsoft.com/zh-cn/virtualization (opens new window)
- https://developer.ibm.com/zh/technologies/containers (opens new window)
- 随笔分类 - Docker (opens new window)
- 容器自动化构建 https://kany.me/tags/docker (opens new window)
- 在 Windows 10 底下不使用 Hyper-V 安裝 Docker (opens new window)
- https://docs.microsoft.com/zh-cn/virtualization/windowscontainers/quick-start/set-up-environment (opens new window)
- https://github.com/badtuxx/DescomplicandoDocker (opens new window)
- https://github.com/yeasy/docker_practice (opens new window)
- 日志查看 https://github.com/amir20/dozzle (opens new window)
- 脚本引擎 https://github.com/dagger/dagger (opens new window)
- 自己动手写docker https://github.com/xianlubird/mydocker (opens new window)
- https://github.com/weaveworks/weave (opens new window)
- https://github.com/jessfraz/dockerfiles (opens new window)
- https://github.com/sickcodes/Docker-OSX (opens new window)
Docker搭建私有仓库
- 企业级Registry服务器 https://github.com/goharbor/harbor (opens new window)
- Docker 私有仓库搭建 (opens new window)
- 从零搭建docker私有仓库 (opens new window)
# 其他容器技术
- https://hub.grapps.cn (opens new window)
- https://github.com/topics/containers (opens new window)
- OCI开放容器标准 https://github.com/opencontainers (opens new window)
- 云原生技术图谱 https://github.com/cncf/landscape (opens new window)
- OCI,CRI,CRI-O,Containerd 名词解释 (opens new window)
- 策略 https://github.com/open-policy-agent (opens new window)
- Go编写的迷你Docker https://github.com/shuveb/containers-the-hard-way (opens new window)
- https://github.com/falcosecurity (opens new window)
- https://github.com/draios (opens new window)
- https://github.com/istio/istio (opens new window)
- 从开发者的角度比较Kubernetes和Cloud Foundry (opens new window)
- k8s https://github.com/kubernetes (opens new window)
- https://github.com/kubernetes-incubator (opens new window)
- https://github.com/kubernetes-sigs (opens new window)
- https://kubernetes.io (opens new window)
- 存储 https://github.com/openebs/openebs (opens new window)
- 软件包管理器 https://github.com/helm (opens new window)
- 脚本安装K8S集群 https://github.com/easzlab/kubeasz (opens new window)
- https://github.com/armosec/kubescape (opens new window)
- https://github.com/fanux/sealos (opens new window)
- https://github.com/clusternet/clusternet (opens new window)
- https://github.com/genuinetools (opens new window)
- https://github.com/kubernetes-sigs (opens new window)
- https://github.com/tektoncd/pipeline (opens new window)
- https://github.com/rancher/fleet (opens new window)
- https://github.com/splunk/qbec (opens new window)
- https://github.com/kube-rs (opens new window)
- https://github.com/pipekit (opens new window)
- https://github.com/teamcode-inc/kubeorbit (opens new window)
- https://github.com/chronolaw/k8s_study (opens new window)
- https://github.com/vmware-tanzu (opens new window)
- https://github.com/lightrun-platform (opens new window)
- https://github.com/Rapha-Borges/oke-free (opens new window)
- https://github.com/k8zdev/k8z (opens new window)
- https://github.com/NVIDIA/gpu-operator (opens new window)
- 监控 https://github.com/keptn (opens new window)
- https://github.com/openshift (opens new window)
- https://github.com/rook/rook (opens new window)
- https://github.com/lensapp/lens (opens new window)
- https://github.com/jenkins-x (opens new window)
- https://github.com/kinvolk (opens new window)
- https://github.com/dapr (opens new window)
- https://github.com/dokku (opens new window)
- https://github.com/cloudfoundry (opens new window)
- https://github.com/distribution/distribution (opens new window)
- cloud-foundry 的动态 - SegmentFault 思否 (opens new window)
- https://www.terraform.io (opens new window)
- https://github.com/rancher/rancher (opens new window)
- https://github.com/mesosphere/marathon (opens new window)
- Ansible
- Packer
- 谷歌、IBM、微软、Pivotal、SAP、SUSE、Swisscom、GE
- https://github.com/wekan/wekan (opens new window)
- https://github.com/google/gvisor (opens new window)
- https://github.com/fnproject (opens new window)
- https://github.com/verrazzano (opens new window)
- systemd-nspawn以及container的学习 (opens new window)
- https://github.com/eclipseo (opens new window)
- https://github.com/coreos (opens new window)
- Linux Container https://github.com/lxc/lxc (opens new window)
- podman https://github.com/containers (opens new window)
- https://github.com/lxc (opens new window)
- https://github.com/AdaptiveScale/lxdui (opens new window)
- https://github.com/iongion/container-desktop (opens new window)
- https://github.com/rancher-sandbox/rancher-desktop (opens new window)
- https://github.com/marhkb/pods (opens new window)
- 再见 Docker,是时候拥抱下一代容器工具了 (opens new window)
- podman初试-和docker对比 (opens new window)
- https://github.com/lxc/incus (opens new window)
- https://github.com/containerd/containerd (opens new window)
- https://github.com/orbstack (opens new window)
- https://github.com/moby/moby (opens new window)
- https://github.com/coreos (opens new window)
- https://github.com/cri-o/cri-o (opens new window)
- https://github.com/kata-containers (opens new window)
- https://github.com/chaosblade-io/chaosblade (opens new window)
- https://github.com/alibaba/pouch (opens new window)
- https://github.com/singularity/singularity (opens new window)
- 集群管理器 https://github.com/apache/mesos (opens new window)
- https://github.com/OpenVZ (opens new window)
- https://github.com/thijsvanloef/palworld-server-docker (opens new window)
运行时
- https://github.com/utam0k/youki (opens new window)
- https://github.com/containers/crun (opens new window)
- https://github.com/oracle/railcar (opens new window)
- https://github.com/opencontainers/runc (opens new window)
- https://github.com/abiosoft/colima (opens new window)
- https://github.com/lima-vm/lima (opens new window)
# 仓库镜像
- Docker官方映像 https://github.com/docker-library (opens new window)
- https://hub.docker.com (opens new window)
- https://hub.daocloud.io (opens new window)
以下镜像地址需要直接配置在docker中,不能通过浏览器访问
- 阿里云 https://cr.console.aliyun.com (opens new window)
- ustc中国科技大学 https://docker.mirrors.ustc.edu.cn (opens new window)
- 网易 http://hub-mirror.c.163.com (opens new window)
- Docker 官方中国区 https://registry.docker-cn.com (opens new window)
- Azure 中国镜像 https://dockerhub.azk8s.cn (opens new window)
- 七牛云加速器 https://reg-mirror.qiniu.com (opens new window)
- 腾讯云 https://mirror.ccs.tencentyun.com (opens new window)
# Docker命令
# 退出docker容器
# 如果容器内部没有任何程序运行, 一旦执行exit, 退出容器时, 容器将结束运行
exit
# 查看运行中的容器
docker ps
# 查看全部的容器, 包括运行中和已停止运行的容器
docker ps -a
# 通过容器名称删除已经停止运行的容器(test-centos为docker run命令中给容器的命名)
docker rm test-centos
# 通过容器ID删除已经停止运行的容器,与上面的命令效果一样, 060e是containerID的前4位
docker rm 060e
# 强制删除状态为Up, 正在运行中的容器
docker rm -f test-centos
# Docker compose
- Docker Compose概述 (opens new window)
- Compose文件参考 (opens new window)
- docker-compose.yml 配置文件编写详解 (opens new window)
- Docker Compose 详解 (opens new window)
- Docker Compose 配置文件详解 (opens new window)
- docker run 和 docker-compose 配置挂载 Volume 并运行 nginx (opens new window)
- https://github.com/Haxxnet/Compose-Examples (opens new window)
Compose 文件是一个 YAML , 主要定义了
services
,networks
和volumes
,其默认路径是./docker-compose.yml
service
定义包含了应用与每个容器的配置,很像给docker run
传参,同样,network
和volume
对于docker network create
和docker volume create
也类似。
像在 Dockerfile (eg:
CMD
,EXPOSE
,VOLUME
,ENV
)可以使用的选项也可以在docker run
参数中使用, 这样在docker-compose.yml
里就不需要再次指定了。
docker-compose.yml
里可以使用环境变量,类似Bash
格式${VARIABLE}
composer
文件格式有两种版本:version 1
: 已经废弃, 不支持volumes
和networks
,默认version key
是省略的。version 2
: 推荐的格式,目前是最新的,需要通过version '2'
指定。
ports
暴露端口。既可以是
HOST:CONTAINER
,也可以只用容器端口(host端口会随机选取)。 当以HOST:CONTAINER
的形式映射端口的时候,当容器的端口低于60的时候可能会遇到错误, 因为YAML会解析 xx:yy 数字为60。 基于这个原因,我们推荐明确指定端口映射用字符串的形式。
volumes
挂载指定的路径或者
named volumes
, 可以在主机上指定一个路径 HOST:CONTAINER ,或者一个可访问的 HOST:CONTAINER:ro 。
# Dockerfile
- Dockerfile参考 (opens new window)
- 编写Dockerfile的最佳实践 (opens new window)
- Dockerfile 基本命令详解 (opens new window)
- 创建
Dockerfile
文件
vi Dockerfile
- 添加内容
# 使用的基础镜像
FROM centos:7
# 作者信息
MAINTAINER bajins "[email protected]"
# 创建目录
RUN mkdir -p /data/java/jdk1.7.0_80
# 把当前目录下的jdk文件夹添加到镜像
ADD jdk1.7.0_80 /data/java/jdk1.7.0_80
# 创建tomcat目录
RUN mkdir -p /data/java/tomcat-8080
# 把当前目录下的tomcat文件夹添加到镜像
ADD tomcat-8080 /data/java/tomcat-8080
# 添加环境变量
ENV JAVA_HOME /data/java/jdk1.7.0_80
ENV CATALINA_HOME /data/java/tomcat-8080
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin
# 暴露容器端口
EXPOSE 8080
EXPOSE 8090
# 启动时运行tomcat
CMD ["/data/java/tomcat-8080/bin/catalina.sh","run"]
FROM centos:7
#安装wget工具
RUN yum -y install wget
#下载并且安装jdk设置环境变量
COPY jdk-8u201-linux-x64.rpm jdk-8u201-linux-x64.rpm
RUN rpm -ivh jdk-8u201-linux-x64.rpm
ENV JAVA_HOME /usr/java/latest/
ENV PATH=$JAVA_HOME/bin:$PATH
ENV CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
RUN rm -rf jdk-8u201-linux-x64.rpm
#时区中文等处理
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo 'Asia/Shanghai' >/etc/timezone
RUN yum -y install kde-l10n-Chinese
#配置显示中文
RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
ENV LC_ALL zh_CN.utf8
RUN echo "export LC_ALL=zh_CN.utf8" >> /etc/profile