Docker安装常用软件
一、基本要用到的几个命令
其实记住下面这两个就行了
docker --help:列出所有命令及其说明
docker COMMAND --help:单个命令的用法
其中安装软件需要用到的
search:查找Docker Hub上的镜像,如docker search mysql
pull:拉取指定镜像,如docker pull mysql:5.6
run:运行容器,如docker run -d --name mymysql -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306 mysql:5.6
ps:查看容器启动情况,如docker ps
二、几个软件运行容器的命令
run命令的使用
[root@thunderclap ~]# docker run --helpUsage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]Run a command in a new containerOptions:--add-host list Add a custom host-to-IP mapping (host:ip)-a, --attach list Attach to STDIN, STDOUT or STDERR--blkio-weight uint16 Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)--blkio-weight-device list Block IO weight (relative device weight) (default [])--cap-add list Add Linux capabilities--cap-drop list Drop Linux capabilities--cgroup-parent string Optional parent cgroup for the container--cidfile string Write the container ID to the file--cpu-period int Limit CPU CFS (Completely Fair Scheduler) period--cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota--cpu-rt-period int Limit CPU real-time period in microseconds--cpu-rt-runtime int Limit CPU real-time runtime in microseconds-c, --cpu-shares int CPU shares (relative weight)--cpus decimal Number of CPUs--cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)--cpuset-mems string MEMs in which to allow execution (0-3, 0,1)-d, --detach Run container in background and print container ID--detach-keys string Override the key sequence for detaching a container--device list Add a host device to the container--device-cgroup-rule list Add a rule to the cgroup allowed devices list--device-read-bps list Limit read rate (bytes per second) from a device (default [])--device-read-iops list Limit read rate (IO per second) from a device (default [])--device-write-bps list Limit write rate (bytes per second) to a device (default [])--device-write-iops list Limit write rate (IO per second) to a device (default [])--disable-content-trust Skip image verification (default true)--dns list Set custom DNS servers--dns-option list Set DNS options--dns-search list Set custom DNS search domains--entrypoint string Overwrite the default ENTRYPOINT of the image-e, --env list Set environment variables--env-file list Read in a file of environment variables--expose list Expose a port or a range of ports--group-add list Add additional groups to join--health-cmd string Command to run to check health--health-interval duration Time between running the check (ms|s|m|h) (default 0s)--health-retries int Consecutive failures needed to report unhealthy--health-start-period duration Start period for the container to initialize before starting health-retriescountdown (ms|s|m|h) (default 0s)--health-timeout duration Maximum time to allow one check to run (ms|s|m|h) (default 0s)--help Print usage-h, --hostname string Container host name--init Run an init inside the container that forwards signals and reaps processes-i, --interactive Keep STDIN open even if not attached--ip string IPv4 address (e.g., 172.30.100.104)--ip6 string IPv6 address (e.g., 2001:db8::33)--ipc string IPC mode to use--isolation string Container isolation technology--kernel-memory bytes Kernel memory limit-l, --label list Set meta data on a container--label-file list Read in a line delimited file of labels--link list Add link to another container--link-local-ip list Container IPv4/IPv6 link-local addresses--log-driver string Logging driver for the container--log-opt list Log driver options--mac-address string Container MAC address (e.g., 92:d0:c6:0a:29:33)-m, --memory bytes Memory limit--memory-reservation bytes Memory soft limit--memory-swap bytes Swap limit equal to memory plus swap: '-1' to enable unlimited swap--memory-swappiness int Tune container memory swappiness (0 to 100) (default -1)--mount mount Attach a filesystem mount to the container--name string Assign a name to the container--network string Connect a container to a network (default "default")--network-alias list Add network-scoped alias for the container--no-healthcheck Disable any container-specified HEALTHCHECK--oom-kill-disable Disable OOM Killer--oom-score-adj int Tune host's OOM preferences (-1000 to 1000)--pid string PID namespace to use--pids-limit int Tune container pids limit (set -1 for unlimited)--privileged Give extended privileges to this container-p, --publish list Publish a container's port(s) to the host-P, --publish-all Publish all exposed ports to random ports--read-only Mount the container's root filesystem as read only--restart string Restart policy to apply when a container exits (default "no")--rm Automatically remove the container when it exits--runtime string Runtime to use for this container--security-opt list Security Options--shm-size bytes Size of /dev/shm--sig-proxy Proxy received signals to the process (default true)--stop-signal string Signal to stop a container (default "SIGTERM")--stop-timeout int Timeout (in seconds) to stop a container--storage-opt list Storage driver options for the container--sysctl map Sysctl options (default map[])--tmpfs list Mount a tmpfs directory-t, --tty Allocate a pseudo-TTY--ulimit ulimit Ulimit options (default [])-u, --user string Username or UID (format: <name|uid>[:<group|gid>])--userns string User namespace to use--uts string UTS namespace to use-v, --volume list Bind mount a volume--volume-driver string Optional volume driver for the container--volumes-from list Mount volumes from the specified container(s)-w, --workdir string Working directory inside the container
比较常用的有-d后台运行,-name指定名称,-port端口映射。
1、MySQL
docker run -p 3306:3306 --name mymysql -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6
-p 3306:3306:将主机的 3306 端口映射到容器的 3306 端口。
-v $PWD/conf:/etc/mysql/conf.d:将主机当前目录下的 conf/my.cnf 挂载到容器的 /etc/mysql/my.cnf。
-v $PWD/logs:/logs:将主机当前目录下的 logs 目录挂载到容器的 /logs。
-v $PWD/data:/var/lib/mysql :将主机当前目录下的data目录挂载到容器的 /var/lib/mysql 。
-e MYSQL_ROOT_PASSWORD=123456:初始化 root 用户的密码。
2、Redis
docker run -p 6379:6379 -v $PWD/data:/data -d redis:3.2 redis-server --appendonly yes
- -p 6379:6379 : 将主机的6379端口映射到容器的6379端口
- -v $PWD/data:/data : 将主机中当前目录下的data挂载到容器的/data
- redis-server --appendonly yes : 在容器执行redis-server启动命令,并打开redis持久化配置
3、Zookeeper
docker run --privileged=true -d --name zookeeper --publish 2181:2181 -d zookeeper:latest
4、RabbitMQ
默认用户名密码(都是guest)
docker run -d --hostname my-rabbit --name rabbit -p 15672:15672 -p 5672:5672 rabbitmq:management
设置用户名密码
docker run -d --hostname my-rabbit --name rabbit -e RABBITMQ_DEFAULT_USER=user -e RABBITMQ_DEFAULT_PASS=password -p 15672:15672 -p 5672:5672 rabbitmq:management
Docker安装常用软件相关推荐
- 【docker11】docker安装常用软件
目录 docker安装常用软件 1.安装软件说明 1.安装tomcat 2.安装mysql 2.1简单版 2.2实战版本 3.安装redis docker安装常用软件 1.安装软件说明 框架图 总体步 ...
- 四、docker系列之docker安装常用软件
docker安装常用软件 目录 docker安装常用软件 docker安装运行redis 一.DockerHup redis仓库 二.镜像拉取 三.镜像启动 四.参数解析 docker安装运行mysq ...
- Docker安装常用软件-Mysql
一.生成镜像 方法一:通过Dockerfile 1.新建目录 mysql D:\docker\docker应用池\mysql mysql目录下创建三个目录 /home/mysql /logs /co ...
- Docker安装常用软件/JAVA/大数据
Docker安装常用软件 文章目录 Docker安装常用软件 一.Docker安装 1. Windows安装Docker Desktop 2. Centos安装Docker 二.大数据组件安装 1. ...
- Docker 安装常用软件(超全、超实用)
容器化概念越来越普及,很多公司都在往这个方向发展,也有不少公司在招聘要求上提到这点.Docker就是一个出色的.开源的应用容器引擎.只需要一条命令就可安装一个软件环境,非常方便. 安装Docker 以 ...
- 使用docker安装常用软件
大家好,我是音乐家. 在docker的自行摸索中,确实踩过很多坑,耽误过很多时间.接下来我会一一讲解常用软件的下载.亲测有效! 目录 1.安装mysql 2.安装mongodb 3.安装rabbitm ...
- Docker 安装一些软件命令
Docker 安装一些软件命令 一.Docker的安装 1. Ubuntu系 2. Centos系 二.Docker可视化控制面板--Portainer汉化版 三.Docker运行Mysql 四.Do ...
- (七) Docker安装常规软件
Docker安装常规软件 一.安装tomcat 1.docker hub上面查找tomcat镜像 2.从docker hub上拉取tomcat镜像到本地 3.docker images查看是否有拉取到 ...
- ubuntu 美化日常配置和安装常用软件保姆级教程
目录 ubuntu 美化配置,日常配置,安装常用软件 前期准备 开机黑屏修复 更改用户名 软件包概念 卸载脚本 安装中文输入法 美化 安装必要软件 安装常用软件 微信 Docker 微信安装教程 QQ ...
最新文章
- python pillow 图片处理
- 【强化学习】Sarsa 和 Sarsa(λ)
- 使用栈Stack实现队列Queue
- 283. 移动零golang
- canvas绘制竖排的数字_Python绘制可爱的卡通人物 | 【turtle使用】
- 数组的升序 java
- 关于OpenCV的那些事——相机姿态更新
- python编程(gevent入门)
- 48. Element isSupported() 方法
- 用css样式修改input控件和button控件
- HDU4825/5536 [01 字典树/简单字典树更新]
- 在线作图|2分钟绘制一张精美的火山图(Volcano Plot)
- windows下ruby安装环境配置
- AD采样前级电路的分析
- CEO陈睿多措施并举,为B站的创新发展护航
- 计算机课excel,计算机excel教学课件.doc
- 工业触屏没有反应的原因?
- C语言union总结
- 湖北一公司发生闪爆事故,这套化工厂巡检系统你有吗?
- 【日常】矩阵正态分布参数检验问题
热门文章
- 计算机三级嵌入式学习笔记一
- MySQL中vhar和varchar和text的区别
- XGBOOST Fit 一直显示Kernel死掉
- 全国计算机等级考试一级试题2,全国计算机等级考试一级试题
- 移植python3.6.2至FCU1101笔记(zlib、sqlite3)
- 用5G“点亮”智慧灯杆!FCU2302赋予智慧城市更多可能
- python数值类型不包含复数_[python学习手册-笔记]003.数值类型
- 《近匠》专访AbleCloud CTO孙志东——物联网云解决方案实践
- 10 个吸引眼球的滚动动画创意
- 【RCJ-2 AC220V 0.015A静态冲击继电器】