当前位置:   article > 正文

docker run报 docker: Error response from daemon: no command specified.

docker run报 docker: Error response from daemon: no command specified.

docker run报 docker: Error response from daemon: no command specified.

1. export出mysql的container为tar, 拷贝到另一台虚拟机, import该tar为image, docker run该image时报 docker: Error response from daemon: no command specified. 时间240211

export出mysql的container为tar, 拷贝到另一台虚拟机, import该tar为image, docker run该image时报 docker: Error response from daemon: no command specified. 时间240211

如果在run句后加bash或/bin/bash, 可以run, 但exec后容器中的mysql不启动

查看原先container的COMMAD, 用docker psdocke ps -a 查看时, COMMAND列短,没法看到全部, 可以加 --no-trunc 参数 Don’t truncate output 不要截断输出

sudo docker ps -a --no-trunc
  • 1

也可以写成

sudo docker ps -a --no-trunc
sudo docker container ls -a --no-trunc
sudo docker container list -a --no-trunc
  • 1
  • 2
  • 3

对比

z@us2243:/root$ sudo docker ps
CONTAINER ID   IMAGE          COMMAND                  CREATED        STATUS        PORTS                                                  NAMES
7cfd759ca381   mysql:8.0.36   "docker-entrypoint.s…"   21 hours ago   Up 21 hours   33060/tcp, 0.0.0.0:8036->3306/tcp, :::8036->3306/tcp   Mysql8036p8036
z@us2243:/root$ sudo docker ps --no-trunc
CONTAINER ID                                                       IMAGE          COMMAND                         CREATED        STATUS        PORTS                                                  NAMES
7cfd759ca3819ab95ccdb2c5672f88cb71018bbe69cf16f90b42134dc56a0fd0   mysql:8.0.36   "docker-entrypoint.sh mysqld"   21 hours ago   Up 21 hours   33060/tcp, 0.0.0.0:8036->3306/tcp, :::8036->3306/tcp   Mysql8036p8036
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

可看到COMMAND为 docker-entrypoint.sh mysqld

在run句后加上 docker-entrypoint.sh mysqld

sudo docker run -itd   --name Mysql8036p8036   -p 8036:3306   -e MYSQL_ALLOW_EMPTY_PASSWORD='root'   mysql:8.0.36   docker-entrypoint.sh mysqld
  • 1

问题解决

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/77661
推荐阅读
相关标签
  

闽ICP备14008679号