csx 发表于 2023-10-11 00:31

docker零基础入门学习

更新系统Debian和Ubuntuapt update -y&& apt upgrade -y && apt install -y curl wget sudo
CentOSyum -y update && yum -y upgrade && yum -y install curl wget sudodocker环境安装环境curl -fsSL https://get.docker.com | sh
启动环境systemctl start docker
开机自启动环境systemctl enable docker
查看docker环境版本docker --version

镜像查看本地镜像列表docker image ls
下载更新镜像docker pull nginx:latest
删除镜像docker rmi nginx:latest



容器部署新容器docker run -d --name nginx --restart always -p 80:80 -p 443:443 -v /home/docker/nginx/conf.d:/etc/nginx/conf.d -v /home/docker/nginx/certs:/etc/nginx/certs -v /home/docker/nginx/html:/var/www/html nginx:latest
docker run -d --name nextcloud --restart=always -p 8080:80 -v /home/docker/nextcloud:/var/www/html -e NEXTCLOUD_ADMIN_USER=kejilion -e NEXTCLOUD_ADMIN_PASSWORD=kejilionYYDS nextcloud

查看所有容器docker ps -a
查看运行的容器docker ps
启动容器docker start nginx
暂停容器docker stop nginx
删除容器docker rm nginx
强制删除容器docker rm -f nginx

启动所有容器docker start $(sudo docker ps -a -q)

暂停所有容器docker stop $(sudo docker ps -a -q)


暂停所有容器
docker rm -f $(sudo docker ps -a -q)
进入容器docker exec -it nginx bash
查看容器日志docker logs nginx

页: [1]
查看完整版本: docker零基础入门学习