docker install and configure
2017-07-26 18:25
369 查看
docker install and configure
概述
Docker系统有两个程序:docker服务端和docker客户端ubuntu install docker
文档 https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04
Step 1 — Installing Docker
Update apt and add the key and repo $sudo apt-get update $sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - root#add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" $sudo apt-get update Make sure you are about to install from the Docker repo instead of the default Ubuntu 16.04 repo: $apt-cache policy docker-ce install Docker: $sudo apt-get install -y docker-ce Check that it's running: $sudo systemctl status docker
Step 2 — Executing the Docker Command Without Sudo (Optional)
add your username to the docker group: $sudo usermod -aG docker ${USER} $su - ${USER} $id -nG $sudo usermod -aG docker username
Step 3 — Using the Docker Command
To view all available subcommands, type: $docker To view the switches available to a specific command, type: $docker docker-subcommand --help To view system-wide information about Docker, use: $docker info
Step 4 — Working with Docker Images
$docker run hello-world
docker create self images
2. 使用Dockerfile 2.1创建镜像所在的文件夹和Dockerfile文件 $mkdir sinatra $cd sinatra $touch Dockerfile 2.2在Dockerfile文件中写入指令,没一条指令都会更新镜像的信息例如: -># This is a comment ->FROM ubuntu:14.04 ->MAINTAINER Kate Smith ksmith@example.com ->RUN apt-get update && apt-get install -y ruby ruby-dev ->RUN gem install sinatra 格式说明: 每行命令都是以 INSTRUCTION statement 形式,就是命令+ 清单的模式。命令要大写,“#”是注解。 FROM 命令是告诉docker 我们的镜像什么。 MAINTAINER 是描述 镜像的创建人。 RUN 命令是在镜像内部执行。就是说他后面的命令应该是针对镜像可以运行的命令。 2.3创建镜像 命令:docker build -t ouruser/sinatra:v2 . docker build 是docker创建镜像的命令 -t 是标识新建的镜像属于 ouruser的 sinatra是仓库的名称 :v2 是tag “.”是用来指明 我们的使用的Dockerfile文件当前目录的 2.4创建完成后,从镜像创建容器 $docker run -t -i ouruser/sinatra:v2 /bin/bash
附1
检查docker的版本 $docker version Docker官方网站专门有一个页面来存储所有可用的镜像,网址是:index.docker.io 命令行的格式为: $docker search 镜像名字 通过docker命令下载tutorial镜像: $docker pull learn/tutorial 在docker容器中运行hello world! $docker run learn/tutorial echo "hello word" 在容器中安装新的程序, 一个简单的程序(ping) $docker run learn/tutorial apt-get install -y ping 获得安装完ping命令之后容器的id $docker ps -l 检查运行中的镜像 $docker ps 查看详细的关于某一个容器的信息 $docker inspect 698 保存对容器的修改 $docker commit 698 learn/ping 运行新的镜像 $docker run lean/ping ping www.google.com 发布自己的镜像 $docker push learn/ping
附2
文档 http://www.jianshu.com/p/3384e342502b
sudo docker run -d --name env_php7_coober -v /var/www:/home/coober/www roydejong/php7-xdebug docker inspect env_php7_coober | grep "IPAddress" docker exec -it env_php7_coober /bin/bash sudo docker cp env_php7_coober:/etc/php/7.0/fpm/pool.d/www.conf ./ sudo docker cp ./www.conf env_php7_coober:/etc/php/7.0/fpm/pool.d/www.conf
supervisor安装配置与使用
服务器启停 sudo /etc/init.d/supervisord {start|stop|status|restart|reload|force-reload|condrestart} 可以通过supervisorctl查看管理监控的进程情况: supervisor>help supervisor>help stop supervisor> stop publisher_for_summary supervisor> start publisher_for_summary supervisor> start all supervisor> stop all supervisor> status
相关文章推荐
- docker-ce Install and configure cc-runtime on Fedora27
- Install Pip with Curl and Python—core—docker
- Install and Configure Skype For Business 2015 Edge Server
- [Linux]Install And Configure Trac
- Install and Configure OpenStack Telemetry Metering Service (Ceilometer)
- Vertex Communications Tax Q Series(CTQ) Install and configure summary
- How to install and configure Jabber Server (Ejabberd) on Debian Lenny GNU / Linux
- MinGW - 安装和配置 / MinGW - Howto Install And Configure
- Install and configure sql server 2008 express
- Step1:Install EBS and Configure
- Install And Configure ColdFusion MX 6.1 on Windows
- install and configure subversion
- Install and configure Quantum network + Linuxbridge for RHEL6.3 (Folsom release)
- 在64位系统下安装32位ODBC驱动问题How to install and configure a 32 bit ODBC driver on a 64 bit Operating System?
- Howto Install and Configure PCL on Ubuntu
- Ganglia install and configure
- Install and Configure OpenStack Image Service (Glance) for Ubuntu 14.04
- Install andConfigure OpenStack Dashboard Service (Horizon) for Ubuntu 14.04
- Install and Configure Bacula on Ubuntu 14.04