docker-compose

Mounting a directory to docker container

邮差的信 提交于 2020-01-13 05:08:07
问题 I am trying to mount a host directory to my nginx docker container. However, it's not mounting what I would expect. docker-compose.yml: nginx: image: nginx volumes: - ./app:/root/testfolder Here's the contents of the directory in the container: root@846e68e6e8b5:/# ls root/testfolder/ 50x.html index.html And the directories on my host: bash-3.2$ ls app bower.json docker-compose.yml gulpfile.js node_modules package.json bash-3.2$ ls app/ app.js assets bower_components common index.html modules

Docker networking on single host with compose

我的未来我决定 提交于 2020-01-13 03:48:08
问题 I am trying to run docker networking with compose in docker 1.9. I know this is still experimental in 1.9, but I'd like to know if my use case could work. Basically and to simplify, I have two servers, each one being in a container. Let's call them S1 and S2. S1 is exposed globally and must be accessible from S2. I want to run S2 through docker-compose with the --x-networking flag (the reason why I want this is that S2 is actually a bit more complexe than what is assumed here, having several

Why has Docker volume run out of space?

人盡茶涼 提交于 2020-01-13 03:48:08
问题 Dockerized database will no longer start because... FATAL: could not write lock file "postmaster.pid": No space left on device There are hundreds of Gb available on my hard-disk although I do believe something has run out of space. This problem first cropped up after a couple of attempts at restoring a 45Gb database from backup. During that time my Docker.qcow2 file ballooned to 60Gb. Does Hypervisor have some limit on the size of that VM file? Using Docker for Mac. It seems to be a clue that

Docker(四):Docker 三剑客之 Docker Compose

与世无争的帅哥 提交于 2020-01-12 21:20:47
前两篇文章我们介绍了 Dockerfile 的使用 Docker(二):Dockerfile 使用介绍 ,我们知道使用一个 Dockerfile 模板文件可以定义一个单独的应用容器,如果需要定义多个容器就需要服务编排。服务编排有很多种技术方案,今天给大家介绍 Docker 官方产品 Docker Compose 。 Dockerfile 可以让用户管理一个单独的应用容器;而 Compose 则允许用户在一个模板(YAML 格式)中定义一组相关联的应用容器(被称为一个 project,即项目),例如一个 Web 服务容器再加上后端的数据库服务容器等。 Docker Compose 介绍 Docker-Compose 是 Docker 的一种编排服务,是一个用于在 Docker 上定义并运行复杂应用的工具,可以让用户在集群中部署分布式应用。 通过 Docker-Compose 用户可以很容易地用一个配置文件定义一个多容器的应用,然后使用一条指令安装这个应用的所有依赖,完成构建。Docker-Compose 解决了容器与容器之间如何管理编排的问题。 Docker Compose 工作原理图 Compose 中有两个重要的概念: 服务 (service) :一个应用的容器,实际上可以包括若干运行相同镜像的容器实例。 项目 (project) :由一组关联的应用容器组成的一个完整业务单元,在

容器技术Docker、Docker-Compose、k8s的演变

匆匆过客 提交于 2020-01-12 18:38:22
  越来越多的应用开始容器化以及上云,可能有些人直接接触的就是k8s(Kubernetes)的概念以及操作了,但是理清一下容器化技术的一些演变过程,是一件很有意思的事情,同时也可以加强我们对容器化技术的深入理解和具体场景下运用哪种技术。 一、Docker vs 虚拟机   KVM技术的发展,解放了单台服务器物理机的资源过剩的浪费,虚拟机的资源互相独立,部署应用不受影响,但缺点是占用资源多,有安全补丁更新时候要一起更新,管理起来比较麻烦。容器Docker就是为了解决这种困境,在耗费资源低的情况下,又可以方便部署资源和依赖互相独立的应用,从而实现快速部署。他们俩的层级差异如图:   正如docker的鲸鱼图上的集装箱一样,docker的容器运行是以沙盒的机制运行,共享底层操作系统,会把应用需要的依赖打包在一起,以沙盒的方式,在同类型的操作系统上,可以自由迁移部署运行,如此就可以极大地解放了部署环境不一致的问题。 二、Docker-Compose 的诞生   容器化的盛行,也带来了新的问题,那就是如何高效地去部署和管理这些镜像呢?因为比较大型的应用服务,往往需要多个组件一起合作才能正常运行,这就给单docker容器部署提出了挑战,Docker-Compose就像下面这只八爪章鱼,可以同时进行多容器的构建以及部署运行。 三、k8s(Kubernetes)的横空出世 vs Docker

Docker(三)--Docker-Compose编排容器

我们两清 提交于 2020-01-12 17:23:39
将本地镜像发布到阿里云 有时候需要共享镜像或者习惯使用自己定义的镜像,可以注册私有仓库,国内推荐使用阿里云 步骤: 1.登录阿里云容器镜像服务:https://cr.console.aliyun.com/cn-hangzhou/instances/repositories 2.将镜像推送到阿里云 # 登录阿里云的docker仓库 $ sudo docker login --username = [ 用户名 ] registry.cn-hangzhou.aliyuncs.com # 创建指定镜像的tag,归入某个仓库 $ sudo docker tag [ ImageId ] registry.cn-hangzhou.aliyuncs.com/wugao/tomcat: [ 镜像版本号 ] # 讲镜像推送到仓库 $ sudo docker push registry.cn-hangzhou.aliyuncs.com/wugao/tomcat: [ 镜像版本号 ] 3.拉取镜像 sudo docker pull registry.cn-hangzhou.aliyuncs.com/wugao/tomcat: [ 镜像版本号 ] Docker 网络 Docker允许通过外部访问容器或容器互联的方式来提供网络服务。 安装Docker时,会自动安装一块Docker网卡称为docker0

Docker service exposed publicly though made to expose ports to localhost only

巧了我就是萌 提交于 2020-01-12 13:47:31
问题 I have created one service and exposed it to run only on localhost in one of my docker swarm node but I can access the service publicly too easily. I have deleted and redeployed the docker stack but still same issue. Here is my docker-compose.yml I have used to deploy the service in stack version: "3" networks: api-net: ipam: config: - subnet: 10.0.10.0/24 services: health-api: image: myprivateregistry:5000/healthapi:qa ports: - "127.0.0.1:9010:9010" networks: - api-net depends_on: - config

docker-compose : Unsupported config option for services service: 'web'

China☆狼群 提交于 2020-01-12 11:56:26
问题 I am going through getting started page for docker-compose: https://docs.docker.com/compose/gettingstarted/ In Step 3, I made a docker-compose.yml file as described: version: '2' services: web: build: . ports: - "5000:5000" volumes: - .:/code depends_on: - redis redis: image: redis But when I run: $ docker-compose up I get following error: Unsupported config option for services service: 'web' I am not able to figure out what is going on. Any help? Thank you 回答1: Support for the version 2

Linux下Docker的安装与使用

ε祈祈猫儿з 提交于 2020-01-11 23:36:29
yum安装Docker最新版和docker-compose(超级简单的安装方法) Install Docker 首先安装依赖 yum install -y yum-utils device-mapper-persistent-data lvm2 然后添加 yum 仓库的 docker 地址 yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo yum 安装 docker yum install -y docker-ce docker-ce-cli containerd.io 安装过程中如果提示一个 GPG key 的提示信息 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35 输入 y 同意继续... 直到 Complete! 安装完成后查看一下 docker 的版本 docker -v 启动 docker systemctl start docker 设置开机自启动 systemctl enable docker Install Docker Compose 下载 docker-compose ,版本 1.25.0 wget https://github.com/docker/compose/releases

Centos7笔记之Docker-compose安装的几种方法

耗尽温柔 提交于 2020-01-11 18:38:13
一、目标 centos7.6下安装Docker-compose安装 二、平台 [root@hiibm ~]# uname -r 3.10.0-957.el7.x86_64 [root@hiibm ~]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core) [root@hiibm ~]# docker-compose version docker-compose version 1.23.2, build 1110ad01 docker-py version: 3.6.0 CPython version: 3.6.7 OpenSSL version: OpenSSL 1.1.0f 25 May 2017 三、解析 推荐使用第三种写好的懒人版 四、方法1:在线安装docker-compose #下载docker-compose curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose #给docker-compose赋权限 chmod +x /usr/local/bin/docker