docker知识总结

安装

windows10 wsl2

  • win10 启用wsl2 并安装ubuntu
    https://www.jianshu.com/p/3e2b7252b4b8

  • Windows10如何更改Docker镜像目录
    https://www.jianshu.com/p/e79f4c938000
    https://blog.youkuaiyun.com/u013948858/article/details/80811986 这个没有试,评论说可能不好使。

  • 查看win10系统版本号
    win+r调出运行窗口,输入winver。

  • wsl2和vmware冲突【未测试下面的链接】
    https://kb.vmware.com/s/article/2146361
    https://www.lance.moe/post-344.html
    https://blog.youkuaiyun.com/m0_46161993/article/details/112907640

  • 安装Docker Desktop报错WSL 2 installation is incomplete.
    https://blog.youkuaiyun.com/qq_39611230/article/details/108625840
    https://docs.microsoft.com/zh-cn/windows/wsl/install-win10#step-4—download-the-linux-kernel-update-package

error

  • docker 桌面版报错error during connect: This error may indicate that the docker daemon is not running.:
    cd “C:\Program Files\Docker\Docker”
    DockerCli.exe -SwitchDaemon
    https://blog.youkuaiyun.com/tangcv/article/details/112238084
    注:如果用命令不好使,直接重启docker客户端也许可以解决问题。

  • Error response from daemon: open \.\pipe\docker_engine_linux: The system cannot find the file speci
    Net stop com.docker.service
    Net start com.docker.service
    注:如果用命令不好使,直接重启docker客户端也许可以解决问题。

  • Failed to start service: The service did not respond to the start or control request in a timely fashion
    Tried everything (reboot, different versions 2.5 , 3.0 , 3.3, power, disabling realtime protection). Only increasing timeout helped me:
    Click Start, click Run, type regedit, and then click OK.
    Locate and then click the following registry subkey:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
    In the right pane, locate the ServicesPipeTimeout entry.
    Note If the ServicesPipeTimeout entry does not exist, you must create it. To do this, follow these steps:
    On the Edit menu, point to New, and then click DWORD Value.
    Type ServicesPipeTimeout, and then press ENTER.
    Right-click ServicesPipeTimeout, and then click Modify.
    Click decimal, type 60000, and then click OK.
    https://stackoverflow.com/questions/61811392/error-installing-docker-desktop-for-windows-10
    https://github.com/docker/for-win/issues/6091

常用操作

1.docker ps -a 列出所有容器
2.docker ps -l 列出正在运行的容器
3.docker inspect node(容器名) 列出该容器的配置信息
4.docker run --name=container01 -i -t ubuntu /bin/bash 创建一个容器名为container01,环境为ubuntu的容器,并运行该容器
5.docker rm CONTAINER_ID(容器ID,通过docker ps -a可以查看) 通过容器ID删除容器,注意,如果容器在运行状态,无法删除
6.docker info 查看docker信息
7.docker images 查看docker的镜像
8.docker rmi 镜像名 删除镜像
9.docker search 查找镜像
10.docker pull 上传镜像
11.docker push 推送镜像
12.docker build . -t image_name
13. docker tag [镜像id] [新镜像名称]:[新镜像标签] 镜像重命名
14. docker stop CONTAINER_ID 停止容器运行

  • 后台运行
    docker run -d …
    docker exec -it containerid /bin/bash

  • docker commit 通过容器构建镜像
    https://www.cnblogs.com/shenh/p/9450163.html

  • 容器的端口映射:
    设置:run[-P][-p] 大写的P表示映射所有-P端口的容器,小写的p表示映射指定-p端口容器
    https://blog.youkuaiyun.com/tororo_cat/article/details/107862522

  • docker容器暴漏多个端口
    -p port1:port2 -p port3:port4 -p port5:port6
    https://www.cnblogs.com/zhzhlong/p/12581934.html

volume:数据共享

  • 不指定host目录挂载docker目录
    在windows wsl上不好找共享位置在哪
    docker run -d --name nginx -v /usr/share/nginx/html nginx
  • 指定host目录挂载docker目录
    docker run -d -p 8080:80 -v /d/001practice/docker/d2/html:/usr/share/nginx/html nginx
    注:host的html文件夹为空时,docker的html文件夹内容并没有拷贝到host的html文件夹中,而是也变为空。 /d/001practice对应windows的路径为D:\001practice。

mount和volume
好像-v后面接绝对路径属于mount
https://blog.youkuaiyun.com/docerce/article/details/79265858
https://www.jianshu.com/p/ef0f24fd0674
https://www.jianshu.com/p/e1bd6e13d8e4
https://blog.youkuaiyun.com/yangshihuz/article/details/103976407
https://blog.youkuaiyun.com/inrgihc/article/details/109001886
https://blog.youkuaiyun.com/u012904680/article/details/81297169

docker镜像导入导出

  • Docker - 实现本地镜像的导出、导入(export、import、save、load)
    https://www.hangge.com/blog/cache/detail_2411.html
  • Docker load 之后镜像名字为none问题解决
    docker save -o redis.tar redis:5.0.2
    https://blog.youkuaiyun.com/Alavn_/article/details/103799826
  • 主机无网情况下如何不通过docker pull导入镜像
    https://blog.youkuaiyun.com/QianLiStudent/article/details/107064119

docker进入容器修改配置文件

sudo docker exec -ti -u root 容器id /bin/bash
apt-get update
apt-get install -y vim
vim /etc/nginx/nginx.conf
https://blog.youkuaiyun.com/luomo0203/article/details/107147802/

docker share

注:我的镜像上传没有成功,
第1次报错如下:
write tcp 192.168.65.3:42932->18.214.230.110:443: use of closed network connection
可能是网络问题,需要换一个网速快的环境。
第2次报错:
Get https://registry-1.docker.io/v2/: EOF
这个错,等一会儿重试就可以了。

上传本地docker image到docker hub
https://www.cnblogs.com/fanqisoft/p/11315392.html
在这里插入图片描述

参考资料

第一个docker化的java应用
https://www.imooc.com/learn/824
docker入门
https://www.imooc.com/learn/867
【入门】Docker练习场
https://tianchi.aliyun.com/competition/entrance/231759/tab/226
https://dockerpractice.readthedocs.io/zh/latest/dockerai/?spm=5176.20850343.J_3678908510.1.22f42854BYnAdr#docker_1
PHP环境LAMP/LNMP安装与配置
https://www.imooc.com/learn/703

其他

  • vi/vim基本使用方法
    https://www.cnblogs.com/itech/archive/2009/04/17/1438439.html

  • brat标注工具镜像
    https://hub.docker.com/r/heliex/docker-brat

  • ubuntu下修改环境变量以及添加PYTHONPATH方法
    https://blog.youkuaiyun.com/weixin_37251044/article/details/79273321
    https://jingyan.baidu.com/article/4f34706e3de476e387b56dd6.html
    https://cloud.tencent.com/developer/article/1396779

  • ubuntu安装软件
    sudo apt-get update
    sudo apt install curl

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值