基于官方postgres docker镜像制作自己的镜像
1、Dockerfile
FROM library/postgres
MAINTAINER wenbin.ouyang #初始化PostgreSQL
ENV POSTGRES_USER root
ENV POSTGRES_PASSWORD root
ENV POSTGRES_DB noah
ADD ./noah_pgsql_init.sql /docker-entrypoint-initdb.d/ #容器运行时监听的端口
EXPOSE
2、构建镜像
docker build -f ./Dockerfile -t oy/pgsql:1.0. .
docker images: 查看镜像
3、创建容器
容器中postgresql的数据存放位置:/var/lib/postgresql/data,通过容器添加卷指令将容器数据存放位置映射到宿主机:-v /var/lib/postgresql/oy_PostgreSQL_1.0.0_data:/var/lib/postgresql/data
docker run -it -p : -v /var/lib/postgresql/oy_PostgreSQL_1..0_data:/var/lib/postgresql/data oy/pgsql:1.0.
docker ps: 查看运行的容器
docker exec -it 容器id /bin/bash:进入到容器
创建容器时的打印:
root@alihkdev13:/usr/local/resource# docker run -it -p 9001:5432 -v /var/lib/postgresql/oy_PostgreSQL_1.0.0_data:/var/lib/postgresql/data oy/pgsql:1.0.0
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process. The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english". Data page checksums are disabled. fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ...
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb. Success. You can now start the database server using: pg_ctl -D /var/lib/postgresql/data -l logfile start waiting for server to start....-- ::08.792 UTC [] LOG: starting PostgreSQL 12.1 (Debian 12.1-.pgdg100+) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.-) 8.3., -bit
-- ::08.803 UTC [] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
-- ::08.861 UTC [] LOG: database system was shut down at -- :: UTC
-- ::08.881 UTC [] LOG: database system is ready to accept connections
done
server started
CREATE DATABASE /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/noah_pgsql_init.sql
psql:/docker-entrypoint-initdb.d/noah_pgsql_init.sql:: NOTICE: table "encryption" does not exist, skipping
DROP TABLE
CREATE TABLE
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT -- ::09.409 UTC [] LOG: received fast shutdown request
waiting for server to shut down....-- ::09.429 UTC [] LOG: aborting any active transactions
-- ::09.430 UTC [] LOG: background worker "logical replication launcher" (PID ) exited with exit code
-- ::09.431 UTC [] LOG: shutting down
-- ::09.526 UTC [] LOG: database system is shut down
done
server stopped PostgreSQL init process complete; ready for start up. -- ::09.653 UTC [] LOG: starting PostgreSQL 12.1 (Debian 12.1-.pgdg100+) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.-) 8.3., -bit
-- ::09.653 UTC [] LOG: listening on IPv4 address "0.0.0.0", port
-- ::09.653 UTC [] LOG: listening on IPv6 address "::", port
-- ::09.670 UTC [] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
-- ::09.718 UTC [] LOG: database system was shut down at -- :: UTC
-- ::09.737 UTC [] LOG: database system is ready to accept connections
基于官方postgres docker镜像制作自己的镜像的更多相关文章
- docker commit 制作自定义tomcat镜像
官网下载的tomcat一般存在漏洞,在生产环境中一般是自己下载jdk和tomcat制作成一个新的镜像使用 1.将jdk和tomcat上传 2.生成 c3 容器 3.将jdk和tomcat拷贝到c3容器 ...
- 基于docker的centos:latest镜像制作nginx的镜像
Dockerfile和nginx.repo在同一目录下 先创建nginx.repo [root@localhost nginx]# cat nginx.repo [nginx] name=nginx ...
- Docker下制作一个容器镜像
操作过程描述: (1)先基于centos的镜像启动一个centos容器 (2)在这个容器中安装nginx (3)然后把这个已经安装了nginx的容器制作成一个docker的镜像 操作:docker c ...
- 使用centos官方镜像制作jdk8环境镜像
首先将jdk文件或者tar包放在/var/local路径下 然后Dockerfile中写 # 以 centos7 为基础镜像 FROM centos:latest MAINTAINER chen # ...
- windows 10专业版14393.447 64位纯净无广告版系统 基于官方稳定版1607制作 更新于20161112
系统特点: 447更新日志(Win10 PC一周年更新正式版14393.447 32位/64位更新补丁KB3200970下载 Flash补丁Kb3202790下载): 1.通过网友的反馈,保留了Edg ...
- Docker镜像管理基础与基于容器的镜像制作示例
一.Docker镜像 Docker镜像是启动Docker容器的一个非常重要的组件.Docker各组件之间的关系如图: Docker镜像含有启动容器所需要的文件系统及其内容,因此Docker镜像用于创建 ...
- 测试环境docker化(一)—基于ndp部署模式的docker基础镜像制作
本文来自网易云社区 作者:孙婷婷 背景 我所在测试项目组目前的测试环境只有一套,在项目版本迭代过程中,开发或产品偶尔会在测试环境进行数据校验,QA人数在不断增加,各个人员在负责不同模块工作时也会产生脏 ...
- 基于url-to-pdf-api构建docker镜像,制作一个网页另存服务
基于url-to-pdf-api构建docker镜像,制作一个网页另存服务 业务背景: 需要根据一个url路径打印这个网页的内容 解决方案: 1.使用wkhtml2pdf 2.使用puppeteer ...
- 为openstack制作CoreOS虚拟机镜像(基于CoreOS官方提供镜像)
OpenStack源码交流群: 538850354 1.下载CoreOS镜像(633.1.0版本) CoreOS官网已经有openstack使用的虚拟机镜像,可以直接下载,然后进行修改 http:// ...
随机推荐
- C++四种类型转换总结
C风格的强制类型转换很简单,均用 Type b = (Type)a 形式转换.C++风格的类型转换提供了4种类型转换操作符来应对不同场合的应用,如下表: 转换类型操作符 作用 const_cast 去 ...
- java 给不同成绩分等级
题目:利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示,60-89分之间的用B表示,60分以下的用C表示. 程序分析:(a>b)?a:b这是条件运算符的基本例子. pack ...
- 【Linux-驱动】RTC设备驱动架构
在Linux操作系统中,RTC设备驱动的架构如下图所示: RTC设备驱动涉及的文件:class.c.rtc-dev.c : 建立/dev/rtc0设备,同时注册相应的操作函数.interface.c ...
- python学习笔记四 (运算符重载和命名空间、类)
从以上代码中应该了解到: obj.attribute 查找的顺序: 从对象,类组成的树中,从下到上,从左到右到查找最近到attribute属性值,因为rec中存在name的属性,所以x.name可以 ...
- (转)当margin-top、padding-top的值为百分比时是如何计算的?
本文链接:https://blog.csdn.net/qq_27437967/article/details/72625900问题:当margin-top.padding-top的值是百分比时,分别是 ...
- 从入门到自闭之Python列表,元祖及range
1.列表 数据类型之一,存储数据,大量的,存储不同类型的数据 列表是一种有序的容器 支持索引 列表是一种可变数据类型 原地修改 列表中只要用逗号隔开的就是一个元素,字符串中只要是占一个位置的就是一个元 ...
- 小白学习django第六站-http相关
请求与相应 HttpRequest对象API def home(request): print('path:', request.path) print('mothod:', request.meth ...
- python-优酷系统管理员视图粗糙版(无详细注释)
目录 Tank-YouKu(仅管理员功能粗糙版) 优酷系统管理员视图功能 前期准备 创库创表语句 安装pymysql模块 安装DBUtils模块 配置 db_pool 项目架构与数据流向 目录结构 s ...
- docker 配置私有仓库
1.使用docker 命令: 1.准备两台虚拟机,这里使用的是centos7,两台使用yum install docker 安装docker; 2.给两台虚拟机设置固定ip: 进入到虚拟机内 敲入命令 ...
- 01 初识HTML
HTML是什么? 超文本标记语言(Hypertext Markup Language, HTML)是一种用于创建网页的标记语言. 本质上是浏览器可识别的规则,我们按照规则写网页,浏览器根据规则渲染我们 ...