赞
踩
Docker 是一个用于开发、发布和运行应用程序的开放平台。Docker 使您能够将应用程序与基础架构分离,以便您可以快速交付软件。使用 Docker,您可以像管理应用程序一样管理基础设施。通过利用 Docker 快速交付、测试和部署代码的方法,可以显着减少编写代码和在生产环境中运行之间的延迟。
安装参考官方地址进行安装即可。以centos7为例,使用yum安装。
sudo yum update
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
docker attach ##Attach local standard input, output, and error streams to a running container docker build ##Build an image from a Dockerfile docker commit ##Create a new image from a container's changes docker cp ##Copy files/folders between a container and the local filesystem docker create ##Create a new container docker diff ##Inspect changes to files or directories on a container's filesystem docker events ##Get real time events from the server docker exec ##Run a command in a running container docker export ##Export a container's filesystem as a tar archive docker history ##Show the history of an image docker images ##List images docker import ##Import the contents from a tarball to create a filesystem image docker info ##Display system-wide information docker inspect ##Return low-level information on Docker objects docker kill ##Kill one or more running containers docker load ##Load an image from a tar archive or STDIN docker login ##Log in to a Docker registry docker logout ##Log out from a Docker registry docker logs ##Fetch the logs of a container docker pause ##Pause all processes within one or more containers docker port ##List port mappings or a specific mapping for the container docker ps ##List containers docker pull ##Pull an image or a repository from a registry docker push ##Push an image or a repository to a registry docker rename ##Rename a container docker restart ##Restart one or more containers docker rm ##Remove one or more containers docker rmi ##Remove one or more images docker run ##Run a command in a new container docker save ##Save one or more images to a tar archive (streamed to STDOUT by default) docker search ##Search the Docker Hub for images docker start ##Start one or more stopped containers docker stats ##Display a live stream of container(s) resource usage statistics docker stop ##Stop one or more running containers docker tag ##Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE docker top ##Display the running processes of a container docker unpause ##Unpause all processes within one or more containers docker update ##Update configuration of one or more containers docker version ##Show the Docker version information docker wait ##Block until one or more containers stop, then print their exit codes
#启动docker
sudo systemctl start docker
#查看镜像
docker images
#查看软件的版本
$ docker search redis
#获取最新的版本
docker pull redis:latest
docker images
#启动redis
docker run -itd --name redis -p 6379:6379 redis
#redis客户端连接redis
docker exec -it redis /bin/bash
到此为止已经创建成功。
docker ps
连接上,我们就可以我们在命令行设置的键值,key1:v1
此处只是以redis为例子,我们可以在docker容器中安装dubbo,mysql,nacos,rocketmq等等,可以高效的搭建本地开发环境。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。