Cfexecute calling curl from a Lucee container


I’m on ubuntun and am running Lucee 5.2 as a container, an app tries to run cfexecute to call a curl command line with switches / parameters and their respective values and variable parameter to get execution result. These other parameter values are passed from a form submission.

The curl command line is like the following:

curl -s -X POST http://localhost/mydir -H "content-type: application/x-www-form-urlencoded" -d 'user=john&company=xyz'

It seems the cfexecute may not have been executed. The variable returns nothing, also, the target server of the caller did not produce anything (no such request seems to goes to the target server from the cfexecute curl call). And I’ve also added outputfile parameter to no avail.

fyi, the curl is using HTTP protocol and returns a token, and if I run the curl command line manually it executes fine with a token returned.

Thoughts? Thanks.

Is there a timeout on the cfexecute?
anything in the error output?
is curl installed in the container?

1 Like

@thefalken excellent inputs, thanks.

RESOLVED because the cfexecute URL needs to be the host’s IP address where the other web server is on. Credit: Ben Botto.

regarding error output, where’s the default error log path for Lucee 5.2 container image?

equally important, the little app under Lucee container simply maps myapp1 for www to /var/www
nothing else, so, couldn’t the app in the container call the host computer’s curl (which has been installed)?
if not, how do I install curl onto this little app (container)? Again, I’m on ubuntu.

No. Think of each container as a separate server. It does not normally have privileges to see anything on the host or other containers for that matter. If you want to run a process on a container you have to install it as part of your Dockerfile.

You could add something like this to your Dockerfile:

RUN	apt-get update && apt-get install -y curl wget

It should be the same as a standard Tomcat based install. For development purposes you could add something like this to your docker-compose.yml file:

    - ./logs/lucee:/opt/lucee/web/logs
    - ./logs/tomcat:/usr/local/tomcat/logs

etc… with your own local paths.


calling a web server using its IP address outside a lucee container on one ubuntu vm works (tips from Ben Botto), odd thing, for a similar ubuntu vm, similar code (other than vm’s ip address) such calling via cfexecute fails, cfhttp indicates connection refused, what could cause this problem?
This ubuntu vm also has curl installed already and I even added
RUN … install curl … {command}
to the docker