社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
私信  •  关注

Manish R

Manish R 最近创建的主题
Manish R 最近回复了
8 年前
回复了 Manish R 创建的主题 » 如何在docker compose中定义一个名为in的环境值?

在docker compose中定义环境变量的方法有很多,如下所示

  1. 在compose文件中定义它并通过shell传递值

enter image description here

    $ export TAG=v1.0

    $ docker-compose up -d
  1. 运行docker compose时可以设置env变量

    docker compose run-e tag=v2.0版

  2. 可以在compose文件中传递外部变量文件

enter image description here

  1. 可以在.env文件中定义默认值

enter image description here

当在多个文件中设置相同的环境变量时,这里使用的是组合使用的优先级来选择使用哪一个值:

  1. 撰写文件
  2. 外壳环境变量
  3. 环境文件
  4. 文档文件
  5. 变量未定义
8 年前
回复了 Manish R 创建的主题 » Docker Mediawiki Docker Pull Mediawiki:1.31.1下载1.27.5

在我的情况下是有效的。见下文

[root@localhost ~]# docker images | grep -i mediawiki
[root@localhost ~]# docker pull mediawiki:1.31.1
1.31.1: Pulling from library/mediawiki
f17d81b4b692: Already exists
376d99d019dc: Pull complete
80b3573727f0: Pull complete
2c492579cd1f: Pull complete
9127acfc108e: Pull complete
475593d953b6: Pull complete
52442c108349: Pull complete
34b7a8ed8171: Pull complete
57b93ed05069: Pull complete
4299e0bacf8f: Pull complete
9263f9577aad: Pull complete
5ca842beb745: Pull complete
087c6240046d: Pull complete
d31af3632f76: Pull complete
8928fd73d252: Pull complete
b089431ea3f4: Pull complete
2b4c5b4f7f57: Pull complete
1b1adac96a5c: Pull complete
b631ea5aef3e: Pull complete
acc040b08360: Pull complete
Digest: sha256:edfd44b7dcb3765e2debe008ba9b4d6f8ecb0e1ff511f58fcc71b2ba28f57246
Status: Downloaded newer image for mediawiki:1.31.1
[root@localhost ~]# docker images | grep -i mediawiki
mediawiki                                             1.31.1              8832e1c4afd5        4 days ago          654MB
[root@localhost ~]# docker --version
Docker version 17.06.0-ce, build 02c1d87

如果检查图像,您会发现版本不是1.13.1,如下所示

[root@localhost medaiocean]# docker inspect 8832e1c4afd5 | jq '.[].Config.Env'
[
  "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
  "PHPIZE_DEPS=autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c",
  "PHP_INI_DIR=/usr/local/etc/php",
  "APACHE_CONFDIR=/etc/apache2",
  "APACHE_ENVVARS=/etc/apache2/envvars",
  "PHP_EXTRA_BUILD_DEPS=apache2-dev",
  "PHP_EXTRA_CONFIGURE_ARGS=--with-apxs2 --disable-cgi",
  "PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2",
  "PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2",
  "PHP_LDFLAGS=-Wl,-O1 -Wl,--hash-style=both -pie",
  "GPG_KEYS=1A4E8B7277C42E53DBA9C7B9BCAA30EA9C0D5763 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3",
  "PHP_VERSION=7.0.32",
  "PHP_URL=https://secure.php.net/get/php-7.0.32.tar.xz/from/this/mirror",
  "PHP_ASC_URL=https://secure.php.net/get/php-7.0.32.tar.xz.asc/from/this/mirror",
  "PHP_SHA256=ff6f62afeb32c71b3b89ecbd42950ef6c5e0c329cc6e1c58ffac47e6f1f883c4",
  "PHP_MD5=",
  "MEDIAWIKI_MAJOR_VERSION=1.27",
  "MEDIAWIKI_BRANCH=REL1_27",
  "MEDIAWIKI_VERSION=1.27.5",
  "MEDIAWIKI_SHA512=2f341ed5afab24b81c315db6bcc58dd617f95231f71408c08bb2a8b974c95b7edd93d0f3c857f24058111c3228b9919a0f1c2fd2f85be940dc571e390225027a"
]

在这种情况下,只需复制dockerfile https://github.com/wikimedia/mediawiki-docker/blob/41b4758701e47c363a49ff2ef8835be5f69cf383/1.31/Dockerfile 并手动生成图像。他们好像把照片贴错了标签。

[root@localhost medaiocean]# ls
Dockerfile
[root@localhost medaiocean]# docker build -t mediawiki:latest .

[root@localhost medaiocean]# docker images | grep -i media
mediawiki                                             latest              27ffb14d783f        3 minutes ago       687MB
mediawiki                                             1.31.1              8832e1c4afd5        4 days ago          654MB
[root@localhost medaiocean]# docker inspect 27ffb14d783f | jq '.[].Config.Env'
[
  "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
  "PHPIZE_DEPS=autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c",
  "PHP_INI_DIR=/usr/local/etc/php",
  "APACHE_CONFDIR=/etc/apache2",
  "APACHE_ENVVARS=/etc/apache2/envvars",
  "PHP_EXTRA_BUILD_DEPS=apache2-dev",
  "PHP_EXTRA_CONFIGURE_ARGS=--with-apxs2 --disable-cgi",
  "PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2",
  "PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2",
  "PHP_LDFLAGS=-Wl,-O1 -Wl,--hash-style=both -pie",
  "GPG_KEYS=1729F83938DA44E27BA0F4D3DBDB397470D12172 B1B44D8F021E4E2D6021E995DC9FF8D3EE5AF27F",
  "PHP_VERSION=7.2.11",
  "PHP_URL=https://secure.php.net/get/php-7.2.11.tar.xz/from/this/mirror",
  "PHP_ASC_URL=https://secure.php.net/get/php-7.2.11.tar.xz.asc/from/this/mirror",
  "PHP_SHA256=da1a705c0bc46410e330fc6baa967666c8cd2985378fb9707c01a8e33b01d985",
  "PHP_MD5=",
  "MEDIAWIKI_MAJOR_VERSION=1.31",
  "MEDIAWIKI_BRANCH=REL1_31",
  "MEDIAWIKI_VERSION=1.31.1",
  "MEDIAWIKI_SHA512=ee49649cc37d0a7d45a7c6d90c822c2a595df290be2b5bf085affbec3318768700a458a6e5b5b7e437651400b9641424429d6d304f870c22ec63fae86ffc5152"
]