docker的感悟

admin2年前IT技术1408

1.容器是类实例化的对象,镜像是静态的类

2.查看正在运行的容器docker ps ,查看所有容器包含停止与暂停的docker ps;

3.拉去官方镜像:docker pull 镜像名称

4.docker run -it ubuntu /bin/bash

 容器是用镜像创建的

5.停止容器  docker stop  容器序列号

  运行容器  docker start  容器序列号

  重启容器  docker restart  容器序列号

6.删除容器 docker rm -f 容器序列号 容器序列号 容器序列号

7.删除镜像 docker rmi  镜像序列号 镜像序列号 镜像序列号

8.容器互相通信

  创建docker网络

  docker network create -d bridge test-net

  基于test-net创建3个容器

  docker run -itd --name test1 --network test-net ubuntu /bin/bash

  docker run -itd --name test2 --network test-net ubuntu /bin/bash

  docker run -itd --name test3 --network test-net ubuntu /bin/bash 

  进入容器

  docker exec -it test1 /bin/bash

  安装ping

  apt-get update

  apt install iputils-ping

9.主机跟容器目录共享 或者主机目录挂载到容器

    docker run --name  myphp-fpm -v ~/nginx/www:/www  -d php:5.6-fpm

    命令说明:

    --name myphp-fpm : 将容器命名为 myphp-fpm。

    -v ~/nginx/www:/www : 将主机中项目的目录 www 挂载到容器的 /www


相关文章

magento1.x开启调试模式

magento1.x开启调试模式

方法一设置:Current Configuration Scope: main website 通过后台控制台来操作,admin->configuration->develope...

汇成制造行业CMS企业建站系统v11.1

汇成制造行业企业网站cms系统v11.1管理地址:http://您的网站/admin/login.asp后台帐号:admin后台密码:admin演示地址:˂a href="ceshi/zhizhao/...

解决Centos7系统更新时报错:Could not resolve host: mirrorlist.centos.org; 未知的错误

1、背景        centos7系统在执行:sudo yum update,发生错误;1.1、错误描述       ...

2018最新WIN10系统各版本最新激活密匙大全

2018最新WIN10系统各版本最新激活密匙大全

 2018最新WIN10系统各版本最新激活密匙大全  2018最新WIN10系统各版本最新激活密匙大全密钥更新:win10企业版(政府版)400年期限密钥【Enterpr...

Xray VLESS / TLS

Xray VLESS / TLS

 Amazon Linux 2 上顺利运行的 Xray 一键安装脚本,包含:Xray VLESS / TLS(443 或 8443,建议用 8443)systemd 自动启动BBR + 内核...

win10 连接L2TP win7 连接L2TP遇到的问题

win10 连接L2TP win7 连接L2TP遇到的问题

PSK共享密钥文件位置/etc/ipsec.secretswin10无法链接的问题解决方案HKEY_LOCAL_MACHINE>SYSTEM>CurrentControlSet>Se...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。