查看“︁Docker”︁的源代码
来自康健生活
←
Docker
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
== docker == {| class="wikitable" |- | [[/container_name|container name]] || 示例 || 示例 |} == dockerfile == {| class="wikitable" |- | [[/dockerfile|dockerfile]] |} == 常见 == {| class="wikitable" |- | [[/多指令|多指令]] || 示例 || 示例 |- | 示例 || 示例 || 示例 |- | 示例 || 示例 || 示例 |} == 应用 == {| class="wikitable" |- | [[/elasticsearch|elasticsearch]] || 示例 || 示例 |- | 示例 || 示例 || 示例 |- | 示例 || 示例 || 示例 |} == 参数 == === --no-cache === == 命令 == {| class="wikitable" |- | [[/if|if]] || 示例 || 示例 |- | 示例 || 示例 || 示例 |- | 示例 || 示例 || 示例 |} == 安装 == {| class="wikitable" |- | [[/macos|macos]] || 示例 || 示例 |} == docker-compose == {| class="wikitable" |- | [[/安装docker-compose|安装docker-compose]] || 示例 || 示例 |- | 示例 || 示例 || 示例 |- | 示例 || 示例 || 示例 |} == 制作镜像 == {| class="wikitable" |- | [[/nginxnode|nginxnode]]|| [[/centos|centos]] || 示例 |- | 示例 || 示例 || 示例 |- | 示例 || 示例 || 示例 |} == 环境 == {| class="wikitable" |- | [[/区分环境|区分环境]] || 示例 || 示例 |- | 示例 || 示例 || 示例 |- | 示例 || 示例 || 示例 |} == 查看 == 我开始查询当前容器。但是抛出 docker 并未运行。 {{Shc_out|<syntaxhighlight lang="bash"> docker container ls -all</syntaxhighlight>|<syntaxhighlight lang="bash"> Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? </syntaxhighlight>|$|/home/kangkk}} 启动 docker 服务。 {{Shc_out|<syntaxhighlight lang="bash"> sudo systemctl start docker.service</syntaxhighlight>|<syntaxhighlight lang="bash"> We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for kangjian: </syntaxhighlight>|$|/home/kangkk}} 再次查看 docker 的状态。 {{Shc_out|<syntaxhighlight lang="bash"> systemctl status docker.service</syntaxhighlight>|<syntaxhighlight lang="bash"> ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled) Active: active (running) since Wed 2022-03-23 14:22:44 CST; 11s ago Docs: https://docs.docker.com Main PID: 24342 (dockerd) Memory: 38.4M CGroup: /system.slice/docker.service └─24342 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock </syntaxhighlight>|$|/home/kangkk}} 再次查询,这个时候提示需要 root 权限。 {{Shc_out|<syntaxhighlight lang="bash"> docker container ls -all</syntaxhighlight>|<syntaxhighlight lang="bash"> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES </syntaxhighlight>|$|/home/kangkk}} {{Shc_out|<syntaxhighlight lang="bash"> sudo docker container ls -all</syntaxhighlight>|<syntaxhighlight lang="bash"> Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json?all=1&limit=1: dial unix /var/run/docker.sock: connect: permission denied </syntaxhighlight>|$|/home/kangkk}} 删除当前容器 {{shc|<syntaxhighlight lang="bash"> docker container rm 容器名</syntaxhighlight>|$|/home/kangkk}} 进入容器 {{shc|<syntaxhighlight lang="bash"> docker exec -it elasticsearch /bin/bash</syntaxhighlight>|$|/home/kangkk}} 查看容器日志地址 {{shc|<syntaxhighlight lang="bash"> sudo docker inspect --format '{{.LogPath}}' 5f3d48017cd3</syntaxhighlight>|$|/home/kangkk}} == 删除 == === 删除镜像 === {{shc|<syntaxhighlight lang="bash"> docker rmi [image]</syntaxhighlight>|$|/home/kangkk}} {{shc|<syntaxhighlight lang="bash"> docker image rm [image]</syntaxhighlight>|$|/home/kangkk}} * -f, -force: 强制删除镜像,即便有容器引用该镜像; * -no-prune: 不要删除未带标签的父镜像; === 删除容器 === == error == {| class="wikitable" |- | [[/端口冲突|端口冲突]] || 示例 || 示例 |- | 示例 || 示例 || 示例 |- | 示例 || 示例 || 示例 |} * Error response from daemon: manifest for elasticsearch:latest not found: manifest unknown: manifest unknown : 需要指定版本号 {{shc|<syntaxhighlight lang="bash"> sudo docker pull elasticsearch:7.6.2</syntaxhighlight>|$|/home/kangkk}} * docker: Error response from daemon: Conflict. The container name "/elasticsearch" is already in use by container "bad7c467154756bdd651080e6d223fa2c380662e6c91af83b9c3c8f958d8f103". You have to remove (or rename) that container to be able to reuse that name. === 部署过程中 === * Back-off restarting failed container : 实例事件中一直出现Back-off restarting failed container的Warning事件,一般是由于通过指定的镜像启动容器后,容器内部没有常驻进程,导致容器启动成功后即退出,从而进行了持续的重启。 == 常见问题 == {| class="wikitable" |- | [[/端口|端口]] || [[复制]] || 示例 |- | 示例 || 示例 || 示例 |- | 示例 || 示例 || 示例 |}
此页面嵌入的页面:
模板:Hc
(
查看源代码
)
模板:Hc/style.css
(
查看源代码
)
模板:Meta box
(
查看源代码
)
模板:Shc
(
查看源代码
)
模板:Shc/style.css
(
查看源代码
)
模板:Shc out
(
查看源代码
)
模板:Shc out/style.css
(
查看源代码
)
模板:Warning
(
查看源代码
)
模板:Warning/style.css
(
查看源代码
)
返回
Docker
。
导航菜单
康健生活
搜索
user-page
通知
user-interface-preferences
个人工具
登录
五一
多读书,多运动,多到远处走走,再看看不一样的世界。