Window 家庭版升级到Window pro(企业版)

docker for window版本使用要求。是否升级系统自己考虑,建议使用Linux/Mac学习Docker

  • 请花钱升级
  • 1. 我的电脑,属性,右下角,更改密钥

  • 2. 输入FMPND-XFTD4-67FJC-HDR8C-3YH26后,系统自动更新重启,重启后就是企业版window了

  • 3. 使用hwidgen激活系统

安装Docker

切换容器

docker for window中有两个容器可以自由切换,切换到window容器只可以下载微软的系统镜像,注意使用时切换到Linux容器(大部分都是使用Linux镜像),如果使用window容器拉取Linux镜像时,会报错。

window下使用文件映射

docker run -it -v E:/DockerShareData/Mysql:/home/mysql mariadb-fisha bash

  • 遇到用户登录错误
    右键电脑,管理,本地用户和组,组,双击Hyper-V Administors,把当前系统用户加入到组中。
    -- 更新 --
    呵呵,并没有什么效果。暂时放弃文件映射使用,当然如果有小伙伴知道的话,欢迎无偿指导
    -- 更新 19/9/17 --
    账号密码不是开机时候你输入的那个,而是你当初在电脑上设置的邮箱账号和密码(博主设置的是微软的账号,前几天弄oneindex的时候惊觉)

设置国内deamon

{
  "registry-mirrors": [
    "https://u8kogbli.mirror.aliyuncs.com",
    "http://hub-mirror.c.163.com"
  ],
  "insecure-registries": [],
  "debug": true,
  "experimental": false
}

docker的一些基本使用

docker --help || docker
//可以使用 docker 参数 command 来查看对应说明
Usage:  docker [OPTIONS] COMMAND    

// self-sufficient是自给自足的意思,连在一起感觉有点拗口(也有点不知所云),
//意思可能是:使用容器服务自带的参数 来查看或设置相关配置信息。
//emmm,注意这些参数是有 - 开头的,英文用options来指代这些参数,需要区别这些参数不是命令(command)
A self-sufficient runtime for containers    
Options:
      --config string      Location of client config files (default
                           "C:\\Users\\fisha\\.docker")
  -c, --context string     Name of the context to use to connect to the
                           daemon (overrides DOCKER_HOST env var and
                           default context set with "docker context use")
  -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
                           "C:\\Users\\fisha\\.docker\\ca.pem")
      --tlscert string     Path to TLS certificate file (default
                           "C:\\Users\\fisha\\.docker\\cert.pem")
      --tlskey string      Path to TLS key file (default
                           "C:\\Users\\fisha\\.docker\\key.pem")
      --tlsverify          Use TLS and verify the remote
  -v, --version            Print version information and quit

Management Commands:   // docker 管理命令,慢慢看
  builder     Manage builds
  config      Manage Docker configs
  container   Manage containers
  context     Manage contexts
  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//从仓库拉去镜像,可先用search搜索镜像再拉取
  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//docker hub上搜索镜像
  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.