1、查询出MongoDB的ID并复制 docker ps -a 该方法也可查询出容器名称,也可不使用ID,使用名称也没问题 2、Docker执行容器 将此处的id替换为MongoDB的ID(可为容器名称) docker exec -it id /bin/bash 3、进入MongoDB mongo