REPOSITORY TAG IMAGE ID CREATED SIZE
sameersbn/redmine latest cdbd133188e5 2 months ago 1.01GB
REPOSITORY #镜像所属的仓库名称
TAG #镜像版本号(标识符),默认为 latest
IMAGE ID #镜像唯一 ID 标示
CREATED #镜像创建时间
VIRTUAL SIZE #镜像的大小
images 导出与导出
docker save centos -o /opt/centos.tar.gz
docker save centos > /opt/centos-1.tar.gz
docker load < /opt/centos.tar.gz
删除镜像,指定端口启用
docker rmi centos
汇总
# docker load -i centos-latest.tar.xz #导入本地镜像
# docker save > /opt/centos.tar #centos #导出镜像
# docker rmi 镜像 ID/镜像名称 #删除指定 ID 的镜像,通过镜像启动容器的
时候镜像不能被删除,除非将容器全部关闭
# docker rm 容器 ID/容器名称 #删除容器
# docker rm 容器 ID/容器名-f #强制删除正在运行的容器
删除某个id
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f1759d1b8abe postgres "docker-entrypoint.s…" 6 weeks ago Up 6 weeks 5432/tcp some-postgres
eae49555c864 sameersbn/postgresql "/sbin/entrypoint.sh" 6 weeks ago Up 6 weeks 5432/tcp postgresql-redmine
bdf5d162155e mysql "docker-entrypoint.s…" 6 weeks ago Up 6 weeks 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql
2a296128cadc jenkins/jenkins:lts-jdk11 "/usr/bin/tini -- /u…" 4 months ago Up 4 months 50000/tcp, 0.0.0.0:8001->8080/tcp, :::8001->8080/tcp jenkins
docker rm -f f1759d1b8abe
f1759d1b8abe
[root@lightnode-wesley-test ~[]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
eae49555c864 sameersbn/postgresql "/sbin/entrypoint.sh" 6 weeks ago Up 6 weeks 5432/tcp postgresql-redmine
bdf5d162155e mysql "docker-entrypoint.s…" 6 weeks ago Up 6 weeks 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql
2a296128cadc jenkins/jenkins:lts-jdk11 "/usr/bin/tini -- /u…" 4 months ago Up 4 months 50000/tcp, 0.0.0.0:8001->8080/tcp, :::8001->8080/tcp jenkins
如果是端口映射的话,#随机端口映射,其实是默认从 32768 开始
指定则 -p
本地端口 81 映射到容器 80 端口
-p 81:80