docker-compose

小白服务器编程指北(2)——用Docker编配你的服务器环境

跟風遠走 提交于 2020-01-22 18:29:30
安装Docker 首先要安装Docker。Docker底层使用的是Linux的容器技术。 所以,为了能够使用Docker,我们需要一台安装了兼容版本的Linux内核和二进制文件的最小化功能宿主机。 笔者这里使用了CentOS 7操作系统。 Step1. Update Docker Package Database 更新yum的repo: sudo yum check - update Step 2: Install the Dependencies 接下来安装Docker的依赖库: sudo yum install - y yum - utils device - mapper - persistent - data lvm2 The yum-utils switch adds the yum-config-manager. Docker uses a device mapper storage driver, and the device-mapper-persistent-data and lvm2 packages are required for it to run correctly. yum-utils会安装yum-config-manager,用于我们下一步配置Docker repo。 Docker需要使用设备存储映射驱动(device mapper storage

Auto create S3 Buckets on localstack

拟墨画扇 提交于 2020-01-22 17:28:09
问题 Using localstack in my docker-compose mainly to mimic S3. I know I can create buckets, thats not the issue. What I would like to do is automatically create the buckets when I run a docker-compose up. Is there something build in already for localstack? 回答1: A change that came in with this commit since version 0.10.0 . When a container is started for the first time, it will execute files with extensions .sh that are found in /docker-entrypoint-initaws.d . Files will be executed in alphabetical

Reuse image built by one service in another service

余生颓废 提交于 2020-01-22 14:08:27
问题 Let's say I have this project structure: proj/ ├── docker │ └── myservice │ └── Dockerfile └── docker-compose.yml And this is my docker-compose.yml : version: '3' services: master: build: docker/myservice slave: image: proj_master depends_on: master I want the master service to create an image, which will be used by the master and the slave services (with different parameters, not shown here). By trial and error I have found out that the slave must refer to the image proj_master . Where is

multi-stage build in docker compose?

痴心易碎 提交于 2020-01-22 07:53:11
问题 How can I specify multi-stage build with in a docker-compose.yml ? For each variant (e.g. dev, prod...) I have a multi-stage build with 2 docker files: dev: Dockerfile.base + Dockerfile.dev or prod: Dockerfile.base + Dockerfile.prod File Dockerfile.base (common for all variants): FROM python:3.6 RUN apt-get update && apt-get upgrade -y RUN pip install pipenv pip COPY Pipfile ./ # some more common configuration... File Dockerfile.dev : FROM flaskapp:base RUN pipenv install --system --skip-lock

Create database on docker-compose startup

和自甴很熟 提交于 2020-01-22 05:01:22
问题 I would like to create a MySQL database using environment variables in docker-compose.yml file, but it is not working. I have the following code: # The Database database: image: mysql:5.7 volumes: - dbdata:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: secret MYSQL_DATABASE: homestead MYSQL_USER: root MYSQL_PASSWORD: secret ports: - "33061:3306" Could someone explain the function of this vars? 回答1: There is also an option to provide an init file for mysql container which

docker-compose部署es集群

核能气质少年 提交于 2020-01-21 20:03:40
通过docker-compose部署es集群。es最新版本:7.5.1 mkdir -p /home/elfk/elasticsearch/config mkdir /home/elfk/elasticsearch/ { data1,data2,data3 } cd /home/elfk echo 'ELK_VERSION=7.5.1' > .env tree . . ├── docker-compose.yml └── elasticsearch ├── config │ └── elasticsearch.yml ├── data1 ├── data2 ├── data3 └── Dockerfile 5 directories, 3 files elasticsearch Dockerfile vim /home/elfk/elasticsearch/Dockerfile ARG ELK_VERSION=7.5.1 # https://github.com/elastic/elasticsearch-docker # FROM docker.elastic.co/elasticsearch/elasticsearch:${ELK_VERSION} FROM elasticsearch:${ELK_VERSION} # Add your elasticsearch

Why docker-compose creates directories/files with user:group 999:999?

自闭症网瘾萝莉.ら 提交于 2020-01-21 11:12:25
问题 I used docker-compose up with the following docker-compose.yml version: '3.5' services: mysql-server: image: mysql:5.7 environment: - MYSQL_ROOT_PASSWORD=root_pwd volumes: - ./var/lib/mysql:/var/lib/mysql:rw The directory ./var/lib/mysql does not exist initially. After running docker-compose up .. ls -al ./var/lib/mysql command shows all the files with user:group 999:999 . I cannot find user or group called 999 in my system. Why docker-compose chooses to create files with a non-existing uid

Docker: Springboot container can not connect to PostgreSql Container Connection error

大兔子大兔子 提交于 2020-01-21 09:06:05
问题 I am building my first Springboot 2.0 application. I am trying to put my Springboot application into one docker container and my PostgresDB into another container. My Dockerfile FROM frolvlad/alpine-oraclejdk8:slim VOLUME /tmp ADD springboot-api-demo-0.1*.jar app.jar RUN sh -c 'touch /app.jar' EXPOSE 9443 ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/urandom -jar /app.jar" ] My docker-compose.yml file version: "2.1" services: springboot-api-demo: image: "fw

CentOS8上用Docker部署开源项目Tcloud

廉价感情. 提交于 2020-01-20 18:50:53
一、 安装 Docker 1、我是虚拟机装的 Centos7,linux 3.10 内核,docker官方说至少3.8以上,建议3.10以上(ubuntu下要linux内核3.8以上) root账户登录,查看内核版本如下 uname -a 2、把 yum包更新到最新 yum update (期间要选择确认,输入 y 即可) 3、安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的 yum install -y yum-utils device-mapper-persistent-data lvm2 4、设置 yum源 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo(阿里仓库) 5、可以查看所有仓库中所有 docker版本,并选择特定版本安装 yum list docker-ce --showduplicates | sort -r 6、安装 Docker,命令:yum install docker-ce-版本号,我选的是docker-ce-18.03.1.ce,如下 yum install docker-ce-18.03.1.ce (期间要选择确认,输入 y 即可) 7

Nacos在Docker环境下的集群部署

感情迁移 提交于 2020-01-20 00:45:50
第一步:准备软件包 git clone https://github.com/nacos-group/nacos-docker.git /software/nacos-docker 安装docker-compose 第二步:安装镜像 cd nacos-docker/ docker-compose -f example/cluster-hostname.yaml up 修改内存大小 vim env/nacos-hostname.env 浏览器访问:http://IP地址:8848/nacos出现下面界面证明集群部署成功 来源: CSDN 作者: 角落里的一本书 链接: https://blog.csdn.net/qq_35232654/article/details/104042394