docker-compose

基于docker-compose部署LNMP

谁说我不能喝 提交于 2019-12-05 15:16:46
一、配置环境 [root@docker ~]# systemctl stop firewalld [root@docker ~]# iptables -F [root@docker ~]# setenforce 0 [root@docker ~]# mkdir docker [root@docker docker]# unzip compose_lnmp-190606.zip [root@docker ~]# cat centos-7-x86_64.tar.gz | docker import - centos:7 将镜像导入到docker [root@docker ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos 7 c2705e1a484d 2 days ago 589MB [root@docker ~]# vim docker/compose_lnmp/nginx/nginx.conf 将Wordpress放到www [root@docker docker]# mv wordpress compose_lnmp/wwwroot/ [root@docker docker]# cd compose_lnmp/wwwroot/ [root@docker wwwroot]# ls index.html

Docker Compose + Postgres: Expose port

本秂侑毒 提交于 2019-12-05 15:09:16
I am currently trying to use Docker for my new Django/Postgres project. I am working on a Mac and usually use Postico to quickly connect to my database. I used to connect like here: I used the official Docker documentation to setup docker-compose. I now have the issue, that I can't connect via Postico to the postgres db. It seems to me that the problem comes from the ports not being exposed. Anyone who can help me with that? version: '3' services: db: image: postgres web: build: . command: python3 manage.py runserver 0.0.0.0:8000 volumes: - .:/code ports: - "8000:8000" depends_on: - db Just

docker

…衆ロ難τιáo~ 提交于 2019-12-05 14:29:29
1)安装docker sudo yum install docker 2)启动docker systemctl start docker.service 3)配置开机启动 [root @localhost ~]#systemctl enable docker.service Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service. [root @localhost ~]#shutdown -r now 重新启动 [root @localhost ~]# systemctl status docker 查看是否启动状态 4)查看docker版本信息 docker version 二、docker-compose 1)下载 docker-compose sudo curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose- uname -s - uname -m -o /usr/local/bin/docker-compose 2)设置权限 sudo chmod +x /usr/local/bin

How to mount docker volume into my docker project using compose?

南楼画角 提交于 2019-12-05 14:12:50
I have a Maven project. I'm running my Maven builds inside Docker. But the problem with that is it downloads all of the Maven dependencies every time I run it and it does not cache any of those Maven downloads. I found some work arounds for that, where you mount your local .m2 folder into Docker container. But this will make the builds depend on local setup. What I would like to do is to create a volume (long live) and link/mount that volume to .m2 folder inside Docker. That way when I run the Docker build for the 2nd time, it will not download everything. And it will not be dependent on

docker-compose: using multiple Dockerfiles for multiple services

…衆ロ難τιáo~ 提交于 2019-12-05 13:38:18
问题 I'm using docker-compose and I'd like to use different Dockerfiles for different services' build steps. The docs seem to suggest to place different Dockerfiles in different directories, but I'd like them all to be in the same one (and perhaps distinguishable using the following convention: Dockerfile.postgres, Dockerfile.main...). Is this possible? Edit: The scenario I have contains this docker-compose file: main: build: . volumes: - .:/code environment: - DEBUG=true postgresdb: extends: file

How do I resolve hostnames to Docker containers from the host?

我们两清 提交于 2019-12-05 12:28:03
问题 I understand Docker runs a magical dns on 127.0.0.11, so I figured I'd try nslookup mycontainername 127.0.0.11 where mycontainername is, of course, the name of the container I'm trying to access. However, that timed out. ;; connection timed out; no servers could be reached What am I doing wrong? I'm on Docker 1.10.3. If it helps, I'm pulling up a bunch of containers using docker-compose 1.6.2. EDIT This is a duplicate of Docker 1.10 access a container by it's hostname from a host machine 回答1:

如何验证docker-compose安装成功

北战南征 提交于 2019-12-05 12:08:15
安装过程及如何验证docker-compose安装成功 步骤1: 通过运行 curl 从GitHub上进行安装下载 sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose 步骤2: 提交执行命令 sudo chmod +x /usr/local/bin/docker-compose 步骤3: 测试是否安装正常 docker-compose --version docker-compose version 1.24.0, build 1110ad01 来源: https://www.cnblogs.com/yangsun/p/11923996.html

使用docker-compose安装wordpress

匆匆过客 提交于 2019-12-05 12:08:06
使用docker-compose安装wordpress 一、Docker配置加速器,更换docker国内源加速安装 使用命令编辑文件,如果没有daemon.json文件,需要新建daemon.json vim /etc/docker/daemon.json 2.加入下面的数据,docker-cn镜像: { "registry-mirrors": ["https://registry.docker-cn.com"] } 3.如果是腾讯云服务器需加上: { "registry-mirrors": ["https://mirror.ccs.tencentyun.com"] } 4.wq保存退出,执行以下命令进行生效: systemctl daemon-reload systemctl restart docker 最后速度飞快,Image可以达到秒pull 二、安装wordpress 1. 定义一个Project 1.1. 在任何Linux目录下,可以新建一个空的工程目录 ``` mkdir my_wordpress/ ``` 1.2. 工程目录下需要包含有docker-compose.yml文件,对于一个好的WordWordPress项目来说,这个文件是需要用到的。 ``` mkdir my_wordpress/ & cd my_wordpress/ & touch docker

Docker Compose编排容器

谁说胖子不能爱 提交于 2019-12-05 11:46:41
1. 前言 Docker Compose 是 Docker 容器进行编排的工具,定义和运行多容器的应用,可以一条命令启动多个容器。 使用Compose 基本上分为三步: Dockerfile 定义应用的运行环境 docker-compose.yml 定义组成应用的各服务 docker-compose up 启动整个应用 Compose和Docker兼容性 compose文件格式版本 docker版本 3.4 17.09.0+ 3.3 17.06.0+ 3.2 17.04.0+ 3.1 1.13.1+ 3.0 1.13.0+ 2.3 17.06.0+ 2.2 1.13.0+ 2.1 1.12.0+ 2.0 1.10.0+ 1.0 1.9.1.+ 2. 安装Compose 直接从github下载即可,前提要先安装Docker,版本要1.9.1以上 Note that Compose 1.8.0 requires Docker Engine 1.10.0 or later for version 2 of the Compose File format, and Docker Engine 1.9.1 or later for version 1. # curl -L https://github.com/docker/compose/releases/download/1.8.0

Unable to mount files in Docker

淺唱寂寞╮ 提交于 2019-12-05 11:46:09
Error description I'm unable to mount files in Vagrant or Docker, so it seems like it's an issue caused by some kind of a permission error. My OS is Ubuntu 18.04 LTS (Bionic Beaver) , I'm not running any access control modules like SELinux as far as I'm aware. The Vagrant-related discussion of the error is found in another question: Unable to mount files in Vagrant Troubleshooting Docker I'm unable to mount files into a Docker container with docker-compose, I'm trying to build: https://github.com/fredrikaverpil/saltstack-docker I set my volumes in the docker-compose file to: volumes: - ${PWD}