Docker

一、Docker概述与安装

末鹿安然 提交于 2021-02-17 02:16:53
一、概述 官网: https://www.docker.com dockerhub: https://hub.docker.com/ Docker 是一个开源的应用容器引擎,基于Go语言,并遵从 Apache2.0 协议开源。 Docker 可以让开发者打包 他们的应用以及依赖包 到一个轻量级、可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化。 容器是完全使用 沙箱机制 ,相互之间不会有任何接口(类似 iPhone 的 app),更重要的是容器性能开销极低。 把项目从windows发布到linux环境并不能跨平台,以前发布一个jar或者war,需要在机器上配置redis、mysql、ES、jdk。使用docker后可以带上环境来打包(镜像)。 二、组成 镜像(image) :通过镜像来创建容器,相当于是一个 root 文件系统,创建 Docker 容器的模板。 容器(container) :独立运行应用,是镜像运行时的实体。 仓库(repository) :Docker 仓库用来保存镜像,可以理解为代码控制中的代码仓库。 三、安装 CentOS的安装文档: https://docs.docker.com/engine/install/centos/ 1、卸载: sudo yum remove docker \ docker-client \ docker

【MongoDB】用Docker安装一个MongoDB最新版玩玩

落花浮王杯 提交于 2021-02-17 01:02:18
1 安装 本文假设大家已经安装好了 docker 并能正常使用,所以不讲解如何安装 docker 了。用 docker 安装 MongoDB 最新版本如下: # 从repository查找mongo的相关镜像,结果很多,其中第一条为官方的镜像 $ docker search mongo # 下载官方镜像的最新版本 $ docker pull mongo:latest # 完成后,检查是否下载成功 $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos 7 5e35e350aded 12 days ago 203MB mongo latest 965553e202a4 3 weeks ago 363MB hello-world latest fce289e99eb9 10 months ago 1.84kB 仅需要简单几个命令,我们就拥有了MongoDB的最新镜像了,后续就可以使用了。 2 启动 完成MongoDB的镜像下载后,启动就非常简单了,一个命令即可: $ docker run -itd --name mongo -p 27017:27017 mongo --auth 305ebd8236678905d16dd76e75dcf99fdd812be6b13c240acece7985d29b316c (1) -

docker,mysql,Navicat

北城以北 提交于 2021-02-17 01:02:00
Navicat破解网址 https://www.jianshu.com/p/5f693b4c9468 docker pull mysql docker run -d -p 3306:3306 --name mysql01 mysql/mysql-server docker logs mysql01 查看日志有默认密码 docker exec -it mysql01 bash 进入到容器里面 # mysql -uroot -p 默认是localhost,然后输入密码 use mysql 提示必须要改密码 修改用户密码 alter user 'root'@'localhost' identified by '123456'; SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password123'); select user,host from user //user表显示信息 改信息 mysql> CREATE USER 'Anker'@ 'localhost' IDENTIFIED BY 'pwd123456'; mysql> GRANT ALL PRIVILEGES ON *.* TO 'Anker'@ 'localhost' WITH GRANT OPTION; mysql> CREATE USER 'Anker'@ '%'

docker和docker-compose

时光怂恿深爱的人放手 提交于 2021-02-16 23:33:21
阅读文本大概需要3分钟。 docker、dockerfile与docker-compose区别 docker:和操作系统无关的一个沙箱容器,宿主机安装的什么操作系统和其本身无关,在它基础上可以制作各种系统类型的基础服务 Dockerfile:是把手工安装docer镜像的过程变成一个配置文件的方式运行,这样每次不需要一步步手敲命令去安装了,而只是需要一个配置文件运行既可生成一个镜像 docker-compos:提供了服务和项目的概念,这样一个服务可以配置多个项目,这个服务是多个项目的集合体,启动和关闭都相对一个一个项目的启动要方便很多 0x01: docker 的安装 第一步:删除旧版本和相关依赖 yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine 第二步: 安装依赖 yum install -y yum-utils \ device-mapper-persistent- data \ lvm2 第三步: 配置稳定的repositories yum-config-manager \ -- add -repo \ https: /

Docker-Compose

主宰稳场 提交于 2021-02-16 23:15:55
借鉴:https://blog.csdn.net/pushiqiang/article/details/78682323 特点: Compose 是 Docker 容器进行编排的工具,定义和运行多容器的应用,可以一条命令启动多个容器。 技术简介 1、Compose 通过一个配置文件来管理多个Docker容器,在配置文件中,所有的容器通过services来定义 2、使用docker-compose脚本来启动,停止和重启应用,和应用中的服务以及所有依赖服务的容器,非常适合组合使用多个容器进行开发的场景。 3、docker-compose默认的模板文件是 docker-compose.yml,其中定义的每个服务都必须通过 image 指令指定镜像或 build 指令(需要 Dockerfile)来自动构建。其它大部分指令都跟 docker run 中的类似。如果使用 build 指令,在 Dockerfile 中设置的选项(例如:CMD, EXPOSE, VOLUME, ENV 等) 将会自动被获取,无需在 docker-compose.yml 中再次设置。 使用Compose 基本上分为三步: 1.Dockerfile 定义应用的运行环境 2.docker-compose.yml 定义组成应用的各服务 3.docker-compose up 启动整个应用 安装compose yum

use docker's remote API in a secure manner

南笙酒味 提交于 2021-02-16 21:28:59
问题 I am trying to find an effective way to use the docker remote API in a secure way. I have a docker daemon running in a remote host, and a docker client on a different machine. I need my solution to not be client/server OS dependent, so that it would be relevant to any machine with a docker client/daemon etc. So far, the only way I found to do such a thing is to create certs on a Linux machine with openssl and copy the certs to the client/server manually, as in this example: https://docs

What's the best way to store a config file for a Docker container on AWS?

寵の児 提交于 2021-02-16 20:35:54
问题 I have a node.js app which has a config file with sensitive data. I want to launch it through AWS ECS (cluster) as a docker container. What would be the best way to store the sensitive config data? I am currently sending them through the environmental variables in the Task Definition of the Docker container, but there has to be a better way to do that. What is the best practice for something like this? Shall I use Docker secrets or Amazon secrets manager? I know it's a pretty general question

What's the best way to store a config file for a Docker container on AWS?

馋奶兔 提交于 2021-02-16 20:35:09
问题 I have a node.js app which has a config file with sensitive data. I want to launch it through AWS ECS (cluster) as a docker container. What would be the best way to store the sensitive config data? I am currently sending them through the environmental variables in the Task Definition of the Docker container, but there has to be a better way to do that. What is the best practice for something like this? Shall I use Docker secrets or Amazon secrets manager? I know it's a pretty general question

AWS Elastic Beanstalk gives “could not translate host name ”db“ to address” error

一世执手 提交于 2021-02-16 18:59:07
问题 I've been trying to deploy my docker consisted of Django, Postgresql and Nginx. It works fine when I do sudo docker-compose up However when deploy it on AWS EB, it gives me could not translate host name "db" to address: Name or service not known What I've done is I pushed my docker to docker hub using sudo docker build -t myname/dockername -f Dockerfile . and I simply do eb deploy File Structure myproject myproject settings.py urls.py ... Dockerfile Dockerrun.aws.json manage.py requirements

AWS Elastic Beanstalk gives “could not translate host name ”db“ to address” error

☆樱花仙子☆ 提交于 2021-02-16 18:57:12
问题 I've been trying to deploy my docker consisted of Django, Postgresql and Nginx. It works fine when I do sudo docker-compose up However when deploy it on AWS EB, it gives me could not translate host name "db" to address: Name or service not known What I've done is I pushed my docker to docker hub using sudo docker build -t myname/dockername -f Dockerfile . and I simply do eb deploy File Structure myproject myproject settings.py urls.py ... Dockerfile Dockerrun.aws.json manage.py requirements