Giter VIP home page Giter VIP logo

docker-openresty's Issues

Unicode not supported in the self-built pcre

Specifically, this happens when I add the "u" option of a regular expression substitution.

-- test.lua
newstr, n, err = ngx.re.gsub("测 试 用 例", "[ \t]", "", "ju")
ngx.say(newstr)

I use docker image tag 1.11.2.1-xenial.

If the image is based on xenial / trusty, would it be better to install pcre and openssl from apt source, just like the openresty official document suggested?

apt-get install libreadline-dev libncurses5-dev libpcre3-dev \
    libssl-dev perl make build-essential

Document adding extra modules

It would be nice if there was some documentation on the recommend way to add extra modules(ie HeadersMore).

Is there a way to do it just using FROM openresty/openrest:tag or are we supposed to manually edit a dockerfile to add options under ./config?

make available on Docker Hub

We should make this available on Docker Hub. Then people can do docker pull openresty/docker-openresty

@agentzh said that he would give @neomantra access to the openresty username on Docker Hub. openresty`. That can happen in private -- this ticket just reminds us to do it :)

automated build issues

Our images now ADD files from this repo into the image (initially to complete #40).

However this broke the automated builds because Docker Hub changes the working directory of its build to where the Dockerfile lives. Thus docker build wasn't seeing the necessary files. [One solution was to copy the relevant files to each sub-directory, but that is long-term hard to manage.]

I have moved the image build to Google Cloud Builder (https://cloud.google.com/container-builder/) and works well. Images from 20171208 and later are currently built with it. They are then pushed by the build system to Docker Hub.

I have not committed the build tooling, but will soon. Some remaining issues:

  • it is currently hosted by a GCP organization other than an "OpenResty one
  • get other OpenResty admins access to it
  • need to get "the public" (you!) access to the build logs for transparency
  • need to sort out some secrets issues

If somebody has a suggestion for another public image building platform than Docker Hub, please let me know. Google Cloud Builder is "almost there" in what it provides; I'll try to work out the remaining issues (notably transparency), but it may be intractable there.

Default modules parity with OpenResty distro

The Dockerfile has a default set of bundled nginx modules that is a subset of what the upstream OpenResty distribution includes. The opinion has involved that these sets should be in parity.

So, examine what modules are in OpenResty upstream and make sure they are included in the Dockerfiles.

No way to make openresty run as PID1

When running the image with the command given in the readme:
docker run [options] openresty/openresty:latest-trusty /usr/local/openresty/nginx/sbin/nginx
The image immediately exits.

If I start the container in an interactive bash shell and then call nginx my pstree looks as follows:

root@f4dbc6cba0ca:/# pstree -npcUa
bash,1
  ├─nginx,73
  │   └─nginx,74                
  └─pstree,81 -npcUa

This is to be expected, one master and one worker process. What doesn't make sense is why this process can't be run as PID1

I have tested this on docker 1.11 and 1.12 beta and both have the same behavior

Luarocks Missing in Stretch

Here's what I get when my build tries to install the uuid rock

Step 2/6 : RUN /usr/local/openresty/luajit/bin/luarocks install uuid
 ---> Running in 24a96b5a9f67
/bin/sh: 1: /usr/local/openresty/luajit/bin/luarocks: not found

I don't think Luarocks is included in stretch, even though the documentation says it's only unavailable in alpine:

LuaRocks is included in the alpine-fat, centos, centos-rpm, trusty, and xenial variants. It is excluded from alpine because it generally requires a build system and we want to keep that variant lean.

openresty not using mime.types

nginx docker images work correctly...files loaded from fs are mapped via conf/mime.types. however, with openresty i have to add include /usr/local/openresty/nginx/conf/mime.types; to get auto type mapping.

should this image contains lua-resty-http?

Hi all,

Our team use openresty with lua-resty-http in the production, and we want to migrate some nginx server from vm to container via this image, but some of useful libraries could not found in it.

Is there any roadmap to support 3rd library in this image?

Thx

resty util requires perl

We were discussing thinning out the Alpine module in #5.

The resty utility script is written in perl. The perl dependency is 40M, almost doubling the size of the image.

Do we exclude perl from the alpine images and require another image on top of it to get resty working?

expire, ttl not are nill, version is the neweast

when I call expire/ttl on shared memory, it says 'attempt to call method 'ttl' (a nil value)', but I saw the arguments in the compilation params, there is nginx version: openresty/1.13.6.1 built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.5) built with OpenSSL 1.0.2k 26 Jan 2017 ... --add-module=../ngx_lua-0.10.11 ....
the instruction from Dockerfile: FROM openresty/openresty:xenial

sorce code:
`local memory = ngx.shared.waf
local restraint = "127.0.0.1"

memory:incr(restraint, 1, 0) -- incr request times: ip, step, initial value
memory:ttl(restraint)
memory:expire(restraint, expire_time)
`

Common Vulnerabilities and Exposures (CVE) on alpine version

We detect, few vulnerabilities critical and major on the alpine docker image,
take a look at the list below ;)
@agentzh, @bakins, @detailyang, @lordnynex, @membphis, @neomantra, @thibaultcha

List

  • musi 1.1.15
  • gdlib 2.2.3-r1
  • pcre
  • freetype
  • libxslt
  • libgcrypt
  • libpng

CVE

CVE-2016-8670
CVE-2016-6912
CVE-2016-10166
CVE-2016-9317
CVE-2016-10168
CVE-2016-9933
CVE-2016-6911
CVE-2016-6906
CVE-2016-10167
CVE-2016-8859
CVE-2017-7245
CVE-2017-7246
CVE-2017-7186
CVE-2017-7244
CVE-2016-10244
CVE-2012-2871
CVE-2016-6313
CVE-2016-10087

Reorganize Docker tags

Over recent time, OpenResty has introduced upstream packages. First the RPMs. Forthcoming are the DEBs. Given this and other discussions, it seems that the following image tags conventions are worth maintaining:

  • centos - based on upstream RPM, replaces centos-rpm
    • xenial - based on upstream DEB
    • alpine - existing alpine Dockerfile
    • alpine-full - alpine package with additional packages such as LuaRocks support

If upstream ever makes an Alpine package, we can use that. It probably is handy to have at least one package that is built within Docker and can be customized with build-args.

should this image do more than build OpenResty

Right now this image just builds OpenResty. People can build on top of this to make more complex deployments and simply use this as a their Dockerfile FROM command. Since OpenResty is so flexible, perhaps this is all it should do.

The nginx docker image includes a default nginx.conf file for serving static content and exposes ports 80 and 443 (which can be remapped at run-time).

We have to be careful of being too tailored to the nginx case because this image can also be used for running resty.

Perhaps we just document the different ways to use it in the README. nginx does that.

tag images with package version

As noted in #45, we should add tags for the specific DEB or RPM package version that is used. But that is fancier that the build system we have now, so we'd need a helper script (maybe using Docker Hub's HTTP triggers)

For example:

  • centos-rpm
  • 1.11.2.4-centos-rpm
  • 1.11.2.4-1.el7.centos-rpm (it is this one we don't do now)

Add nginx (or openresty user) to run nginx

Similar to the official nginx docker container it would be ideal to run the openresty nginx server as a non root user. https://github.com/nginxinc/docker-nginx/blob/25a3fc7343c6916fce1fba32caa1e8de8409d79f/stable/alpine/Dockerfile#L52

This would simplify the handling of nginx.conf quite a bit. Because the nginx user is not present in the openresty container the nginx.conf can't contain a line like user nginx;. For a non container deployment it's recommended to use a non root user. For this reason I run openresty under nginx with the nginx.conf directive of user nginx;. I need to maintain two different nginx.conf file for a container runtime and a non container runtime.

process exit with code 132

When I try to start a docker container using the command:
docker run -it -p 8888:80 openresty/openresty:alpine
it stops with exit code 132.

dmesg says:

[ 7037.973584] docker0: port 1(vethd17cbc4) entered blocking state
[ 7037.973587] docker0: port 1(vethd17cbc4) entered disabled state
[ 7037.974176] device vethd17cbc4 entered promiscuous mode
[ 7037.977153] IPv6: ADDRCONF(NETDEV_UP): vethd17cbc4: link is not ready
[ 7038.455470] eth0: renamed from veth377baff
[ 7038.470311] IPv6: ADDRCONF(NETDEV_CHANGE): vethd17cbc4: link becomes ready
[ 7038.470384] docker0: port 1(vethd17cbc4) entered blocking state
[ 7038.470386] docker0: port 1(vethd17cbc4) entered forwarding state
[ 7038.848814] traps: openresty[11535] trap invalid opcode ip:7ffa43f3cc08 sp:7ffd03b36190 error:0
[ 7038.848829]  in libluajit-5.1.so.2.1.0[7ffa43f35000+276000]
[ 7039.174984] docker0: port 1(vethd17cbc4) entered disabled state
[ 7039.175110] veth377baff: renamed from eth0
[ 7039.297612] docker0: port 1(vethd17cbc4) entered disabled state
[ 7039.304632] device vethd17cbc4 left promiscuous mode
[ 7039.304647] docker0: port 1(vethd17cbc4) entered disabled state

docker info

Containers: 12
 Running: 0
 Paused: 0
 Stopped: 12
Images: 7
Server Version: 17.05.0-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 71
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9048e5e50717ea4497b757314bad98ea3763c145
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.10.0-20-generic
Operating System: Ubuntu 17.04
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.856GiB
Name: armit-pc
ID: ASVC:P2BR:M7SV:3KOM:66KK:IIU5:5K3L:RYGM:RJAF:FTSD:D2W2:DNMN
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support

docker images openresty/openresty:alpine

REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
openresty/openresty   alpine              1aa892b461b2        3 weeks ago         44.9MB

Any idea what this could be?

Add image to official repository

This may a slightly more involved process, but have you considered contributing this image to the docker official images repository?

I was personally surprised at having to use openresty/openresty and I'm sure a lot of people are too.

The official builds are tracked at docker-library/official-images and the README file has instructions on how to propose adding the image.

Alpine image is broken

From a comment from vus520 on Docker Hub:

1.9.7.4-alpine, (alpine/Dockerfile)

Error loading shared library libgcc_s.so.1: No such file or directory (needed by /usr/local/openresty/luajit/lib/libluajit-5.1.so.2)
Error relocating /usr/local/openresty/luajit/lib/libluajit-5.1.so.2: _Unwind_SetIP: symbol not found
Error relocating /usr/local/openresty/luajit/lib/libluajit-5.1.so.2: _Unwind_GetCFA: symbol not found
Error relocating /usr/local/openresty/luajit/lib/libluajit-5.1.so.2: _Unwind_DeleteException: symbol not found
Error relocating /usr/local/openresty/luajit/lib/libluajit-5.1.so.2: _Unwind_SetGR: symbol not found
Error relocating /usr/local/openresty/luajit/lib/libluajit-5.1.so.2: _Unwind_RaiseException: symbol not found

Although he didn't leave much other info, I guess LuaJIT has a dependency on gcc's runtime library. So the cleanup phase of the docker image build process needs to be adjusted.

debian build images...

Greetings!

Let me direct your attention to debian builds I did based on your xenial Dockerfile. Both jessie and wheezy build successfully.

On wheezy I had to only reference libgd2-noxpm-dev instead of libgd-dev, and the build succeeded.

You can see it here: https://github.com/krull/docker-openresty

I have left attribution as-is. I just wanted to have an all debian stack versus having to contaminate my stack with some other deb flavor other than debian itself 👍

Feel free to include them here for others to use.

Hope this helps!

Use CMD instead of ENTRYPOINT

In docker ENTRYPOINT is making it harder to debug by overwriting the entrypoint,
chaining containers together, makes it easier to inherit from this container in other Lua containers.
It's easier to run for example:

docker run -it openresty/openresty sh

xenial image not including fastcgi?

I downloaded xenial image but I'm getting errors with all fastcgi directives:

nginx                  | nginx: [emerg] unknown directive "fastcgi_read_timeout" in /usr/local/openresty/nginx/conf/nginx.conf:39

Using the same nginx.conf with official nginx image is ok

flesh out default configure options

Currently the configure options are:

  • --with-ipv6
  • --with-pcre-jit

As the defaults configure options will be used by everyone who pulls the image from Docker Hub, we should include the most common options, perhaps including ones that have security best practices.

rocks installed by luarocks could not be found

I'm trying to build

FROM openresty/openresty:xenial
MAINTAINER Leandro Moreira <[email protected]>

RUN apt-get -y update && apt-get install -y git
RUN /usr/local/openresty/luajit/bin/luarocks install ledge

ENTRYPOINT ["/usr/local/openresty/bin/openresty", "-g", "daemon off;"]

And then when I try to use the ledge library it shows that it couldn't find it at the available paths, should I set LUA_PATH by hand?

Removing intermediate container e71dc5ffb472
Step 4/5 : RUN /usr/local/openresty/luajit/bin/luarocks install ledge
 ---> Running in 485daee4b982

Missing dependencies for ledge:
lua-resty-cookie >= 0.1
lua-resty-redis-connector >= 0.03
lua-resty-http >= 0.10
lua-resty-qless >= 0.08
lua-ffi-zlib >= 0.1

Installing https://luarocks.org/ledge-1.28-1.src.rock...
Using https://luarocks.org/ledge-1.28-1.src.rock... switching to 'build' mode
Using https://luarocks.org/lua-resty-cookie-0.1.0-1.rockspec... switching to 'build' mode
Cloning into 'lua-resty-cookie'...
Note: checking out 'bbd0df6bca3cac22138225d6a36243ce767d5881'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

No existing manifest. Attempting to rebuild...
Updating manifest for /usr/local/openresty/luajit/lib/luarocks/rocks
lua-resty-cookie 0.1.0-1 is now built and installed in /usr/local/openresty/luajit (license: BSD)

Using https://luarocks.org/lua-resty-redis-connector-0.06-0.src.rock... switching to 'build' mode
Updating manifest for /usr/local/openresty/luajit/lib/luarocks/rocks
lua-resty-redis-connector 0.06-0 is now built and installed in /usr/local/openresty/luajit (license: 2-clause BSD)

Using https://luarocks.org/lua-resty-http-0.11-0.src.rock... switching to 'build' mode
Updating manifest for /usr/local/openresty/luajit/lib/luarocks/rocks
lua-resty-http 0.11-0 is now built and installed in /usr/local/openresty/luajit (license: 2-clause BSD)

Using https://luarocks.org/lua-resty-qless-0.11-0.src.rock... switching to 'build' mode
Updating manifest for /usr/local/openresty/luajit/lib/luarocks/rocks
lua-resty-qless 0.11-0 is now built and installed in /usr/local/openresty/luajit (license: 2-clause BSD)

Using https://luarocks.org/lua-ffi-zlib-0.3-0.src.rock... switching to 'build' mode
Updating manifest for /usr/local/openresty/luajit/lib/luarocks/rocks
lua-ffi-zlib 0.3-0 is now built and installed in /usr/local/openresty/luajit

Updating manifest for /usr/local/openresty/luajit/lib/luarocks/rocks
ledge 1.28-1 is now built and installed in /usr/local/openresty/luajit (license: 2-clause BSD)

 ---> 6fcb5d1a7dcd
Removing intermediate container 485daee4b982
Step 5/5 : ENTRYPOINT /usr/local/openresty/bin/openresty -g daemon off;
 ---> Running in 42546db846dd
 ---> 21c10cbadb2c
Removing intermediate container 42546db846dd
Successfully built 21c10cbadb2c
Successfully tagged ledgedocker_nginx:latest
Creating network "ledgedocker_default" with the default driver
Creating ledgedocker_redis_1 ...
Creating ledgedocker_redis_1 ... done
2017/08/29 01:27:58 [error] 1#1: init_by_lua error: init_by_lua:2: module 'ledge' not found:
	no field package.preload['ledge']
	no file '/usr/local/openresty/site/lualib/ledge.ljbc'
	no file '/usr/local/openresty/site/lualib/ledge/init.ljbc'
	no file '/usr/local/openresty/lualib/ledge.ljbc'
	no file '/usr/local/openresty/lualib/ledge/init.ljbc'
	no file '/usr/local/openresty/site/lualib/ledge.lua'
	no file '/usr/local/openresty/site/lualib/ledge/init.lua'
	no file '/usr/local/openresty/lualib/ledge.lua'
	no file '/usr/local/openresty/lualib/ledge/init.lua'
	no file './ledge.lua'
	no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/ledge.lua'
	no file '/usr/local/share/lua/5.1/ledge.lua'
	no file '/usr/local/share/lua/5.1/ledge/init.lua'
	no file '/usr/local/openresty/luajit/share/lua/5.1/ledge.lua'
	no file '/usr/local/openresty/luajit/share/lua/5.1/ledge/init.lua'
	no file '/usr/local/openresty/site/lualib/ledge.so'
	no file '/usr/local/openresty/lualib/ledge.so'
	no file './ledge.so'
	no file '/usr/local/lib/lua/5.1/ledge.so'
	no file '/usr/local/openresty/luajit/lib/lua/5.1/ledge.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
	[C]: in function 'require'
	init_by_lua:2: in main chunk
nginx: [error] init_by_lua error: init_by_lua:2: module 'ledge' not found:
	no field package.preload['ledge']
	no file '/usr/local/openresty/site/lualib/ledge.ljbc'
	no file '/usr/local/openresty/site/lualib/ledge/init.ljbc'
	no file '/usr/local/openresty/lualib/ledge.ljbc'
	no file '/usr/local/openresty/lualib/ledge/init.ljbc'
	no file '/usr/local/openresty/site/lualib/ledge.lua'
	no file '/usr/local/openresty/site/lualib/ledge/init.lua'
	no file '/usr/local/openresty/lualib/ledge.lua'
	no file '/usr/local/openresty/lualib/ledge/init.lua'
	no file './ledge.lua'
	no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/ledge.lua'
	no file '/usr/local/share/lua/5.1/ledge.lua'
	no file '/usr/local/share/lua/5.1/ledge/init.lua'
	no file '/usr/local/openresty/luajit/share/lua/5.1/ledge.lua'
	no file '/usr/local/openresty/luajit/share/lua/5.1/ledge/init.lua'
	no file '/usr/local/openresty/site/lualib/ledge.so'
	no file '/usr/local/openresty/lualib/ledge.so'
	no file './ledge.so'
	no file '/usr/local/lib/lua/5.1/ledge.so'
	no file '/usr/local/openresty/luajit/lib/lua/5.1/ledge.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
	[C]: in function 'require'
	init_by_lua:2: in main chunk
make: *** [start] Error 1

When I ran the show command on the rock:

ledge 1.28-1 - An ESI capable HTTP cache module for OpenResty

License: 	2-clause BSD
Homepage: 	https://github.com/pintsized/ledge
Installed in: 	/usr/local/openresty/luajit

Modules:
	ledge.esi (/usr/local/openresty/luajit/share/lua/5.1/ledge/esi.lua)
	ledge.header_util (/usr/local/openresty/luajit/share/lua/5.1/ledge/header_util.lua)
	ledge.jobs.collect_entity (/usr/local/openresty/luajit/share/lua/5.1/ledge/jobs/collect_entity.lua)
	ledge.jobs.purge (/usr/local/openresty/luajit/share/lua/5.1/ledge/jobs/purge.lua)
	ledge.jobs.revalidate (/usr/local/openresty/luajit/share/lua/5.1/ledge/jobs/revalidate.lua)
	ledge.ledge (/usr/local/openresty/luajit/share/lua/5.1/ledge/ledge.lua)
	ledge.response (/usr/local/openresty/luajit/share/lua/5.1/ledge/response.lua)

Depends on:
	lua-resty-cookie
	lua-resty-redis-connector
	lua-ffi-zlib
	lua-resty-qless
	lua-resty-http

luarocks install lua-cjson broke in 1.11.2.3

Hi all,
My Docker build breaks since a few days ago on the luarocks install lua-cjson step. Here's my Dockerfile:

FROM openresty/openresty:trusty

EXPOSE 80

# ... credential passing ... #

RUN mkdir /var/log/nginx

RUN sudo apt-get install -y python

RUN /usr/local/openresty/luajit/bin/luarocks install lua-resty-http
RUN /usr/local/openresty/luajit/bin/luarocks install lua-cjson
...

Here's the build output:

Step 1 : FROM openresty/openresty:trusty
trusty: Pulling from openresty/openresty
8f229c550c2e: Pulling fs layer
8e1fb71e8df6: Pulling fs layer
f75a34586856: Pulling fs layer
8744e322b832: Pulling fs layer
d5165bfce78f: Pulling fs layer
5a2803531d69: Pulling fs layer
8f229c550c2e: Waiting
8e1fb71e8df6: Waiting
f75a34586856: Waiting
8744e322b832: Waiting
d5165bfce78f: Waiting
5a2803531d69: Waiting
8e1fb71e8df6: Verifying Checksum
8e1fb71e8df6: Download complete
f75a34586856: Verifying Checksum
f75a34586856: Download complete
8744e322b832: Verifying Checksum
8744e322b832: Download complete
d5165bfce78f: Verifying Checksum
d5165bfce78f: Download complete
8f229c550c2e: Verifying Checksum
8f229c550c2e: Download complete
5a2803531d69: Verifying Checksum
5a2803531d69: Download complete
8f229c550c2e: Pull complete
8f229c550c2e: Pull complete
8e1fb71e8df6: Pull complete
8e1fb71e8df6: Pull complete
f75a34586856: Pull complete
f75a34586856: Pull complete
8744e322b832: Pull complete
8744e322b832: Pull complete
d5165bfce78f: Pull complete
d5165bfce78f: Pull complete
5a2803531d69: Pull complete
5a2803531d69: Pull complete
Digest: sha256:1b0df410ce4e53b0e516a3b63b3707c9fde1ce86f803e12520495dc121eb0c56
Status: Downloaded newer image for openresty/openresty:trusty
 ---> ad2172685db9
Step 2 : EXPOSE 80
 ---> Running in be2a5aff8132
 ---> 12863bfbb40c
# ... things happening ... #
Step 5 : RUN mkdir /var/log/nginx
 ---> Running in ce443aa719ca
 ---> 4a3553bb1159
Step 6 : RUN sudo apt-get install -y python
 ---> Running in d854312e6d8b
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python-minimal
  python2.7 python2.7-minimal
Suggested packages:
  python-doc python-tk python2.7-doc binfmt-support
The following NEW packages will be installed:
  libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python
  python-minimal python2.7 python2.7-minimal
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 3731 kB of archives.
After this operation, 16.0 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libpython2.7-minimal amd64 2.7.6-8ubuntu0.3 [307 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty-updates/main python2.7-minimal amd64 2.7.6-8ubuntu0.3 [1187 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libpython2.7-stdlib amd64 2.7.6-8ubuntu0.3 [1873 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ trusty/main libpython-stdlib amd64 2.7.5-5ubuntu3 [7012 B]
Get:5 http://archive.ubuntu.com/ubuntu/ trusty-updates/main python2.7 amd64 2.7.6-8ubuntu0.3 [197 kB]
Get:6 http://archive.ubuntu.com/ubuntu/ trusty/main python-minimal amd64 2.7.5-5ubuntu3 [27.5 kB]
Get:7 http://archive.ubuntu.com/ubuntu/ trusty/main python amd64 2.7.5-5ubuntu3 [134 kB]
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin: 
Fetched 3731 kB in 2s (1848 kB/s)
Selecting previously unselected package libpython2.7-minimal:amd64.
(Reading database ... 17182 files and directories currently installed.)
Preparing to unpack .../libpython2.7-minimal_2.7.6-8ubuntu0.3_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.6-8ubuntu0.3) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../python2.7-minimal_2.7.6-8ubuntu0.3_amd64.deb ...
Unpacking python2.7-minimal (2.7.6-8ubuntu0.3) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../libpython2.7-stdlib_2.7.6-8ubuntu0.3_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.6-8ubuntu0.3) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../libpython-stdlib_2.7.5-5ubuntu3_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.5-5ubuntu3) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.6-8ubuntu0.3_amd64.deb ...
Unpacking python2.7 (2.7.6-8ubuntu0.3) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../python-minimal_2.7.5-5ubuntu3_amd64.deb ...
Unpacking python-minimal (2.7.5-5ubuntu3) ...
Selecting previously unselected package python.
Preparing to unpack .../python_2.7.5-5ubuntu3_amd64.deb ...
Unpacking python (2.7.5-5ubuntu3) ...
Processing triggers for mime-support (3.54ubuntu1.1) ...
Setting up libpython2.7-minimal:amd64 (2.7.6-8ubuntu0.3) ...
Setting up python2.7-minimal (2.7.6-8ubuntu0.3) ...
Linking and byte-compiling packages for runtime python2.7...
Setting up libpython2.7-stdlib:amd64 (2.7.6-8ubuntu0.3) ...
Setting up libpython-stdlib:amd64 (2.7.5-5ubuntu3) ...
Setting up python2.7 (2.7.6-8ubuntu0.3) ...
Setting up python-minimal (2.7.5-5ubuntu3) ...
Setting up python (2.7.5-5ubuntu3) ...
 ---> fc986cb4c93a
Step 7 : RUN /usr/local/openresty/luajit/bin/luarocks install lua-resty-http
 ---> Running in a1034728ae62
Installing https://luarocks.org/lua-resty-http-0.10-0.src.rock...
Using https://luarocks.org/lua-resty-http-0.10-0.src.rock... switching to 'build' mode
Updating manifest for /usr/local/openresty/luajit/lib/luarocks/rocks
No existing manifest. Attempting to rebuild...
lua-resty-http 0.10-0 is now built and installed in /usr/local/openresty/luajit (license: 2-clause BSD)

 ---> 2e1c5c0b8712
Step 8 : RUN /usr/local/openresty/luajit/bin/luarocks install lua-cjson
 ---> Running in cafdec7414d3
Archive:  lua-cjson-2.1.0.zip
   creating: lua-cjson-2.1.0/
  inflating: lua-cjson-2.1.0/runtests.sh  
  inflating: lua-cjson-2.1.0/fpconv.c  
  inflating: lua-cjson-2.1.0/lua-cjson.spec  
  inflating: lua-cjson-2.1.0/rfc4627.txt  
  inflating: lua-cjson-2.1.0/dtoa.c  
  inflating: lua-cjson-2.1.0/lua-cjson-2.1.0-1.rockspec  
  inflating: lua-cjson-2.1.0/manual.txt  
  inflating: lua-cjson-2.1.0/performance.html  
  inflating: lua-cjson-2.1.0/CMakeLists.txt  
  inflating: lua-cjson-2.1.0/fpconv.h  
  inflating: lua-cjson-2.1.0/strbuf.h  
  inflating: lua-cjson-2.1.0/strbuf.c  
  inflating: lua-cjson-2.1.0/NEWS    
  inflating: lua-cjson-2.1.0/manual.html  
  inflating: lua-cjson-2.1.0/lua_cjson.c  
  inflating: lua-cjson-2.1.0/LICENSE  
  inflating: lua-cjson-2.1.0/dtoa_config.h  
   creating: lua-cjson-2.1.0/tests/
  inflating: lua-cjson-2.1.0/tests/bench.lua  
  inflating: lua-cjson-2.1.0/tests/numbers.json  
  inflating: lua-cjson-2.1.0/tests/example3.json  
  inflating: lua-cjson-2.1.0/tests/octets-escaped.dat  
 extracting: lua-cjson-2.1.0/tests/types.json  
  inflating: lua-cjson-2.1.0/tests/genutf8.pl  
  inflating: lua-cjson-2.1.0/tests/rfc-example1.json  
  inflating: lua-cjson-2.1.0/tests/example4.json  
  inflating: lua-cjson-2.1.0/tests/example2.json  
  inflating: lua-cjson-2.1.0/tests/README  
  inflating: lua-cjson-2.1.0/tests/rfc-example2.json  
  inflating: lua-cjson-2.1.0/tests/test.lua  
  inflating: lua-cjson-2.1.0/tests/example5.json  
  inflating: lua-cjson-2.1.0/tests/example1.json  
  inflating: lua-cjson-2.1.0/g_fmt.c  
  inflating: lua-cjson-2.1.0/Makefile  
   creating: lua-cjson-2.1.0/lua/
  inflating: lua-cjson-2.1.0/lua/lua2json.lua  
  inflating: lua-cjson-2.1.0/lua/json2lua.lua  
   creating: lua-cjson-2.1.0/lua/cjson/
  inflating: lua-cjson-2.1.0/lua/cjson/util.lua  
  inflating: lua-cjson-2.1.0/performance.txt  
  inflating: lua-cjson-2.1.0/THANKS  
lua_cjson.c:1298:13: error: static declaration of 'luaL_setfuncs' follows non-static declaration
 static void luaL_setfuncs (lua_State *l, const luaL_Reg *reg, int nup)
             ^
In file included from lua_cjson.c:44:0:
/usr/local/openresty/luajit/include/luajit-2.1/lauxlib.h:88:18: note: previous declaration of 'luaL_setfuncs' was here
 LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
                  ^

Error: Build error: Failed compiling object lua_cjson.o
Installing https://luarocks.org/lua-cjson-2.1.0-1.src.rock...
Using https://luarocks.org/lua-cjson-2.1.0-1.src.rock... switching to 'build' mode
gcc -O2 -fPIC -I/usr/local/openresty/luajit/include/luajit-2.1 -c lua_cjson.c -o lua_cjson.o
The command '/bin/sh -c /usr/local/openresty/luajit/bin/luarocks install lua-cjson' returned a non-zero code: 1

Add `1.11.2.4-stretch` tag

Hi

I see that you've recently added stretch support, congratulations and thank you for your hard work!

However, most docker images based off of the openresty image should be tagged more specifically for compatibility reasons.

I see that openresty doesn't use semver which already makes it difficult to understand which images are non-breaking. All the more reason to use a specific tag.

OPM on alpine documentation missing curl instructions

The README sais that to get opm working in the alpine image, you need to "apk add perl".
The alpine image doesn't contain curl so opm just gives a server error back

opm search without curl added:

 ~ docker run -ti --rm openresty/openresty:alpine sh -c 'apk add --no-cache perl && opm search lock'
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
(1/1) Installing perl (5.24.1-r2)
Executing busybox-1.26.2-r5.trigger
OK: 46 MiB in 25 packages
ERROR: failed to search: server error.

With curl added

 ~ docker run -ti --rm openresty/openresty:alpine sh -c 'apk add --no-cache perl curl && opm search lock'
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
(1/5) Installing ca-certificates (20161130-r2)
(2/5) Installing libssh2 (1.8.0-r1)
(3/5) Installing libcurl (7.55.0-r0)
(4/5) Installing curl (7.55.0-r0)
(5/5) Installing perl (5.24.1-r2)
Executing busybox-1.26.2-r5.trigger
Executing ca-certificates-20161130-r2.trigger
OK: 47 MiB in 29 packages
openresty/lua-resty-lock                          Simple shm-based nonblocking lock API

Problem with default conf

Is the COPY command for nginx.conf working for the docker?

If I docker exec into the container the file /usr/local/openresty/nginx/conf/nginx.conf it's
the default config.

Not sure what's the working directory for the Docker build but the nginx.conf is in ../nginx.conf. Should the COPY command be COPY ../nginx.conf /usr/local/openresty/nginx/conf/nginx.conf?

What else could cause my conf to be the default and not conatining the include state include /etc/nginx/conf.d/*.conf;

COPY nginx.conf /usr/local/openresty/nginx/conf/nginx.conf

Make envsubst available in the images

The official nginx image includes the envsubst command in the final image, and even refers to it in the documentation as a workaround for using environment variables in nginx configuration.

Is there a reason why it's not included in the Openresty images (admittedly I've only checked jessie, which is missing the gettext-base package) and/or is there an alternative for using environment variables for Openresty configuration?

Use OpenResty RPM packages for Centos build

There are now production RPMs for OpenResty. Use them for a Docker image.

I'm thinking of having a specific tag for these, e.g. centos-rpm, as the existing centos tag provides more customizability.

We should also make it easy to use the other flavors of RPMs, e.g. -debug, -valgrind, etc.

include init script

@agentzh said there should be an init script. Is the idea to control the start/stop of the container? Or of the nginx service inside it. In other words, are you expecting this init script to be run inside or outside the container by the machine host?

Usage of luarocks in docker container

Hello,
I'm using your xenial image like a parent for my image and install some packages with "/usr/local/openesty/luajit/bin/luarocks install " none of them can't be detected by Lua scripts.
FROM openresty/openresty:latest-xenial

WORKDIR /opt

RUN /usr/local/openresty/luajit/bin/luarocks install lbase64 \
&& /usr/local/openresty/luajit/bin/luarocks install lzlib 0.4.work3-1 \
&& /usr/local/openresty/luajit/bin/luarocks install xml \
&& /usr/local/openresty/luajit/bin/luarocks install lua-resty-http \
&& mkdir /opt/ssl && mkdir /opt/proxy

EXPOSE 5080

Error during the build when using php:fpm-alpine as the base image

If I replace FROM alpine:latest with FROM php:fpm-alpine in alpine/Dockerfile, I get the following error during the build:

DYNLINK   libluajit.so
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: lj_err_dyn.o: relocation R_X86_64_TPOFF32 against `static_uex' can not be used when making a shared object; recompile with -fPIC
lj_err_dyn.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:702: recipe for target 'libluajit.so' failed
make[1]: Leaving directory '/tmp/openresty-1.11.2.2/build/LuaJIT-2.1-20161104/src'
make[1]: *** [libluajit.so] Error 1
make: *** [default] Error 2
Makefile:111: recipe for target 'default' failed
ERROR: failed to run command: make -j1 TARGET_STRIP=@: CCDEBUG=-g XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT' CC=cc PREFIX=/usr/local/openresty/luajit

Could you help me figure out how to fix it, please?

P. S. I understand that this issue should not be in this repo, because there is nothing wrong with your Dockerfile, I just wanted to get help from the experts.

relative paths in a lua block don't seem to work in a docker container

I'm using a short nginx.conf with an init_by_lua_block that opens a file and reads it whole like this:
fh = io.open("./app/allowed_users.json", "r")
however, while the path definitely exists relative to the nginx.conf opening the file always fails. ( fh will be null )

The file itself has 644 permission and is owned by root/root.

However, if I do the same thing on a local openresty on the host (no docker), the exact same nginx.conf and path-layout works fine and the file (w/ relative path) is read successfully.

Only if I change the path to an absolute one does it work in the docker container, but I'm trying to a void this.

Any pointers would be greatly appreciated.

help needed

Could someone please post a simple hello world?

Installing luasec with luarockt fails

I've attempted to install luasec, as I have some code that does HTTPS requests and requires TLS, therefore I've attempted to install luasec in my docker image by running this:

RUN /usr/local/openresty/luajit/bin/luarocks install luasec

Although I end up getting this error:

Step 7/13 : RUN /usr/local/openresty/luajit/bin/luarocks install luasec
 ---> Running in 054990a68d2a
Warning: falling back to curl - install luasec to get native HTTPS support
Installing https://luarocks.org/luasec-0.6-1.rockspec...

Error: Could not find header file for OPENSSL
  No file openssl/ssl.h in /usr/local/include
  No file openssl/ssl.h in /usr/include
You may have to install OPENSSL in your system and/or pass OPENSSL_DIR or OPENSSL_INCDIR to the luarocks command.
Example: luarocks install luasec OPENSSL_DIR=/usr/local
Using https://luarocks.org/luasec-0.6-1.rockspec... switching to 'build' mode
The command '/bin/sh -c /usr/local/openresty/luajit/bin/luarocks install luasec' returned a non-zero code: 1

I've attempted do download the the openssl-1.0.2f manually, extract it to the /usr/local/openssl dir and run it with luarocks install luasec OPENSSL_DIR=/usr/local although I end up getting other errors saying other files are now missing.

TO give you some context, here is my Dockerfile:

FROM openresty/openresty:alpine-fat

RUN apk add --no-cache git

RUN /usr/local/openresty/luajit/bin/luarocks install md5 
RUN /usr/local/openresty/luajit/bin/luarocks install luasocket

RUN cd /tmp \
        && curl -fSL https://www.openssl.org/source/openssl-1.0.2f.tar.gz -o openssl-1.0.2f.tar.gz \
        && tar xzf openssl-1.0.2f.tar.gz \
        && mkdir -p /usr/include/openssl \
        && cp -R openssl-1.0.2f/ssl/* /usr/include/openssl \
        && cp -R openssl-1.0.2f/crypto/* /usr/include/openssl \
        && cp -R openssl-1.0.2f/*.h /usr/include/openssl \
        && rm -rf openssl-1.0.2f/

RUN /usr/local/openresty/luajit/bin/luarocks install luasec OPENSSL_INCDIR=/usr/include

Any ideas how I can get around this issue?

1.13.6.1 docker images

Hi

Wondering when the latest release (1.13.6.1) pre-built docker images will be put on docker hub?

Thanks!

Illegal instruction (core dumped)

When I run docker run -i -t --rm openresty/openresty:alpine on a virtual machine, it will finish immediately with a 132 return value. This has never happened when I run it on my laptop. So I run docker run -i -t --rm --entrypoint=/bin/sh openresty/openresty:alpine to get a shell and see what happened. I get this:

$ docker run -i -t --rm --entrypoint=/bin/sh openresty/openresty:alpine 
/ # /usr/local/openresty/bin/openresty 
Illegal instruction (core dumped)
/ # /usr/local/openresty/luajit/bin/luajit
Illegal instruction (core dumped)

Because the nginx installed by apk add runs well, I think it maybe caused by luajit. As you can see luajit do failed.

I have tried to build the image from Dockerfile which will compile the source on that virtual machine, but it also failed. I have also tried centos tag, still failed.
Howerver, the openresty/openresty:latest image runs well. It is an old version with alpine:3.4, and not in the tags list of docker hub now.

I am not familiar with the 'illegal instruction' error. I only know that it is related to cpus. So, here is some cpu information of the virtual machine:

$ uname -a
Linux xxx.xxx.xxx.com 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ cat /proc/cpuinfo 
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 23
model name	: Intel(R) Xeon(R) CPU           X5450  @ 3.00GHz
stepping	: 6
microcode	: 0x60f
cpu MHz		: 2991.330
cache size	: 6144 KB
physical id	: 0
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx lm constant_tsc arch_perfmon pebs bts nopl tsc_reliable nonstop_tsc aperfmperf pni ssse3 cx16 sse4_1 tsc_deadline_timer hypervisor lahf_lm dtherm tsc_adjust
bogomips	: 5985.00
clflush size	: 64
cache_alignment	: 64
address sizes	: 43 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 23
model name	: Intel(R) Xeon(R) CPU           X5450  @ 3.00GHz
stepping	: 6
microcode	: 0x60f
cpu MHz		: 2991.330
cache size	: 6144 KB
physical id	: 2
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 2
initial apicid	: 2
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx lm constant_tsc arch_perfmon pebs bts nopl tsc_reliable nonstop_tsc aperfmperf pni ssse3 cx16 sse4_1 tsc_deadline_timer hypervisor lahf_lm dtherm tsc_adjust
bogomips	: 5985.00
clflush size	: 64
cache_alignment	: 64
address sizes	: 43 bits physical, 48 bits virtual
power management:

Could any body help me to solve this problem? Should I change the configuration of the VM, or there are some other ways?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.