登录docker镜像:
docker exec -it container-id/container-name bash
如报bash错,可以使用:docker exec -it container-id/container-name /bin/sh
退出docker镜像:
exit
拷贝本地文件到docker容器:
1.查找需要拷贝文件的镜像:docker ps -a
2.查找镜像的长ID:docker inspect -f '{{.ID}}' platform----platform为镜像Names
3.拷贝命令:docker cp 本地路径 容器长ID:容器路径
docker cp /root/test.sh 6666666666666666666666666666666:/root/
修改docker容器时间与本地一致:
修改Dockerfile文件
ENV TIME_ZONE Asia/Shanghai
RUN apk add --no-cache tzdata #有些容器里没有/usr/share/zoneinfo目录
RUN echo "${TIME_ZONE}" > /etc/timezone
RUN ln -sf /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime