Docker

Django cannot connect to mysql

走远了吗. 提交于 2021-02-20 02:57:09
问题 So i put my django app and mysql inside docker container. Here is what i do Docker file FROM python:3 ENV PYTHONUNBUFFERED 1 WORKDIR /app COPY requirements.txt /app/requirements.txt RUN pip install -r requirements.txt COPY . /app and here is my docker-compose-yml version: '3' services: db: container_name: database image: mysql:8 ports: - "3306:3306" command: --default-authentication-plugin=mysql_native_password environment: - MYSQL_DATABASE=django_example - MYSQL_USER=root - MYSQL_PASSWORD

CentOS7 下Docker安装、启动

不想你离开。 提交于 2021-02-20 02:54:30
↑点击上方 “程序猿技术大咖” 免费订阅 最近在搞微服务,打算采用docker进行部署,便于环境迁移。本文就在CentOS 7下安装docker的过程,进行汇总整理,与大家进行分享,成功安装过程见2.2章节。 1、检查系统内核 Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker 。 通过 uname -r 命令查看你当前的内核版本。 [xcbeyond@docker ~]$ uname -r 3.10 . 0 - 327.10 . 1 .el7.x86_64 2、安装Docker 安装过程及其坎坷,出现了各种问题,并进行记录整个过程,与大家进行分享。 2.1 节记录安装过程中出现的各种问题,2.2节整理的是安装成功过程,作为正常安装步骤。 2.1 安装失败 (1)Docker 软件包和依赖包已经包含在默认的 CentOS-Extras 软件源里。执行命令 yum install docker 安装过程如下: [xcbeyond@docker etc]$ sudo yum install docker Loaded plugins: fastestmirror, langpacks base | 3.6 kB 00:00:00 docker-ce-stable | 2.9 kB 00:00:00

docker入门1-docker container

主宰稳场 提交于 2021-02-20 02:43:55
image和container介绍 一个image是一个可被docker执行的包,它包括程序运行的所有东西,包括代码,运行时,库,环境变量和配置文件。 一个container是image在内存中的运行实例,一个image可以产生多个container实例。 docker container命令 查看docker版本 # docker --version Docker version 18.09.2, build 6247962 使用 docker version (不带 -- )会得到更详细的版本信息. 查看docker状态 docker info 测试docker安装 docker run hello-world 测试运行 hello-world image. docker image ls 或 docker images 列出所有已下载的image. docker container ls --all 列出所有container. 构建docker app app.dockerfile # use an official python runtime as a parent image FROM python:2.7-slim # set the working directory to /app WORKDIR /app # copy the current

Docker: can't connect Spring Boot & MYSQL

房东的猫 提交于 2021-02-20 02:15:45
问题 I try containerize my project with Dockerfile or Docker-compose. Firstly, I create container from mysql with command: docker run --name ms -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password mysql then I create database and table in container and put data in table, then I build image of my project: docker build -f Dockerfile -t week . and i have logs: Sending build context to Docker daemon 212.1MB Step 1/4 : FROM openjdk ---> 30503f5328a0 Step 2/4 : ADD target/week10-1.0-SNAPSHOT.jar week10.jar --->

DNS resolution in docker containers

自古美人都是妖i 提交于 2021-02-20 00:40:29
问题 [ environment ] CentOS 7 Docker 19.03.12, build 48a66213fe I have a failing cerbot (let's encrypt client) inside a docker container. It looks like acme-v02.api.letsencrypt.org is not resolvable from the container but is resolvable from the host (the most probable cause). I am used to the fact that containers inherit from the host's DNS parameters but, in the case of AWS EC2 instances, there seems to be some subtilities DNS Manual setting [ec2-user@ip-172-31-32-243 ~]$ cat /etc/resolv.conf #

According to the union file system, does image actually container another image?

岁酱吖の 提交于 2021-02-19 23:42:09
问题 In Docker, an image is a stack of Read-only image layers. We also know that images share layers or other images. My question is about how this sharing mechanism work. Does an image have pointers to the Docker storage driver or do they actually contain other layers? If the first one is true, does that mean Dockerfile saves those layers into daemon and the image is the instruction of retrieving those layers orderly? 回答1: It depends on your storage driver: Docker uses storage drivers to manage

According to the union file system, does image actually container another image?

微笑、不失礼 提交于 2021-02-19 23:41:59
问题 In Docker, an image is a stack of Read-only image layers. We also know that images share layers or other images. My question is about how this sharing mechanism work. Does an image have pointers to the Docker storage driver or do they actually contain other layers? If the first one is true, does that mean Dockerfile saves those layers into daemon and the image is the instruction of retrieving those layers orderly? 回答1: It depends on your storage driver: Docker uses storage drivers to manage

According to the union file system, does image actually container another image?

試著忘記壹切 提交于 2021-02-19 23:41:46
问题 In Docker, an image is a stack of Read-only image layers. We also know that images share layers or other images. My question is about how this sharing mechanism work. Does an image have pointers to the Docker storage driver or do they actually contain other layers? If the first one is true, does that mean Dockerfile saves those layers into daemon and the image is the instruction of retrieving those layers orderly? 回答1: It depends on your storage driver: Docker uses storage drivers to manage

docker跨主机通信-手工版

Deadly 提交于 2021-02-19 22:46:42
#A主机 192.168.100.120# 在主机A中创建一个子网,范围是10.52.100.2->10.52.100.254 docker network create --subnet=10.52.100.0/24 snake120 运行一个centos7的容器作为客户端 docker run --name centos -dit --network snake120 --ip 10.52.100.2 uhub.service.ucloud.cn/pub021/centos:7.4.1708 增加路由指向目标地址所在的宿主机,-net 目标IP , gw 网关IP ,默认eth0网卡 route add -net 10.52.121.0 netmask 255.255.255.0 gw 192.168.100.121 服务端开放转发规则,用于B主机向A主机通信 iptables -A FORWARD -j ACCEPT #B主机 192.168.100.121# 在主机B中创建一个子网,范围是10.52.121.2->10.52.121.254 docker network create --subnet=10.52.121.0/24 snake121 运行一个目标服务 docker run --name nginx -dit --network snake121 --ip

搭建互联网架构学习--001--前言

北城以北 提交于 2021-02-19 17:13:29
前言: 自己也参与过app上的前后端分离项目,说是项目,其实就是app上一个新的功能。和其他功能不相干,所以不是在公司app项目基础上做的新增,而是一个单独的maven项目,具体到代码,自己参与的还只是CRUD,写service,以至于再去面试,别人问到这个前后端分离的一些具体问题,自己就答不上来。离开了上家公司,所以想把前后端分离模式下的一些细节问题弄懂。在网上买的这个教程。题目是《从无到有搭建中小型互联网公司后台服务架构与运维架构》,感觉这个正是自己想要了解的。学学吧,这里做一些记录,以便日后使用查阅。如有错误,请指教,谢谢! 这是课程介绍的内容: 本课程主要是针对如何从无到有搭建中小型互联网公司后台服务架构和运维架构的课程,课程所涉及的内容均是当前应用最广泛的技术和工具。本课程所讲解的技术体系已经在多个中小型互联网公司中实战运行使用,目前运行已经非常稳定,数据量也是在不断持续增加。并且,这个技术体系也正在被其他很多互联网公司应用,希望通过此课程,让大家能快速熟练掌握各个技术,并且能实际应用到项目中。课程将会通过实际案例讲解,并且会提供完整的视频案例源码供学员学习使用,同时有需要的企业或学员可以直接拿本套教学案例代码来使用或者二次开发。 本课程设计的技术及工具如下: 后台服务架构:dubbo、spring-boot、spring mvc、spring-security