Reputation: 3782
I have this definition of Nifi container in docker-compose.yml
file. I changed the default Nifi port from 8080 to 8181. It works correctly. However, I cannot copy flow.xml.gz
to Nifi container.
nifi:
image: xemuliam/nifi
network_mode: "host"
ports:
- "8181:8181"
expose:
- "8181"
environment:
- NIFI_WEB_HTTP_PORT=8181
- NIFI_WEB_HTTP_HOST=0.0.0.0
volumes:
- ./src/data_flow_engine/flow.xml.gz:/opt/nifi/conf/flow.xml.gz
- ./src/data_flow_engine/bootstrap.conf:/opt/nifi/conf/bootstrap.conf
When I comment out - ./src/data_flow_engine/flow.xml.gz:/opt/nifi/conf/flow.xml.gz
, then it runs well.
This is the error message:
2018-11-02 12:49:47,818 INFO [main] org.eclipse.jetty.server.Server Started @41290ms
nifi_1 | 2018-11-02 12:49:47,818 WARN [main] org.apache.nifi.web.server.JettyServer Failed to start web server... shutting down.
nifi_1 | org.apache.nifi.web.NiFiCoreException: Unable to start Flow Controller.
nifi_1 | at org.apache.nifi.web.contextlistener.ApplicationStartupContextListener.contextInitialized(ApplicationStartupContextListener.java:88)
nifi_1 | at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:876)
nifi_1 | at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:532)
nifi_1 | at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:839)
nifi_1 | at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:344)
nifi_1 | at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1480)
nifi_1 | at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1442)
nifi_1 | at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:799)
nifi_1 | at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)
nifi_1 | at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:540)
nifi_1 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
nifi_1 | at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
nifi_1 | at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
nifi_1 | at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
nifi_1 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
nifi_1 | at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
nifi_1 | at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
nifi_1 | at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
nifi_1 | at org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart(GzipHandler.java:290)
nifi_1 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
nifi_1 | at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
nifi_1 | at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
nifi_1 | at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
nifi_1 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
nifi_1 | at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
nifi_1 | at org.eclipse.jetty.server.Server.start(Server.java:452)
nifi_1 | at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
nifi_1 | at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
nifi_1 | at org.eclipse.jetty.server.Server.doStart(Server.java:419)
nifi_1 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
nifi_1 | at org.apache.nifi.web.server.JettyServer.start(JettyServer.java:777)
nifi_1 | at org.apache.nifi.NiFi.<init>(NiFi.java:157)
nifi_1 | at org.apache.nifi.NiFi.<init>(NiFi.java:71)
nifi_1 | at org.apache.nifi.NiFi.main(NiFi.java:292)
nifi_1 | Caused by: java.nio.file.FileSystemException: ./conf/flow.xml.gz: Resource busy
nifi_1 | at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
nifi_1 | at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
nifi_1 | at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
nifi_1 | at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:244)
nifi_1 | at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
nifi_1 | at java.nio.file.Files.deleteIfExists(Files.java:1165)
nifi_1 | at org.apache.nifi.persistence.StandardXMLFlowConfigurationDAO.save(StandardXMLFlowConfigurationDAO.java:165)
nifi_1 | at org.apache.nifi.controller.StandardFlowService.load(StandardFlowService.java:536)
nifi_1 | at org.apache.nifi.web.contextlistener.ApplicationStartupContextListener.contextInitialized(ApplicationStartupContextListener.java:72)
nifi_1 | ... 33 common frames omitted
nifi_1 | 2018-11-02 12:49:47,819 INFO [Thread-1] org.apache.nifi.NiFi Initiating shutdown of Jetty web server...
nifi_1 | 2018-11-02 12:49:47,820 INFO [Thread-1] o.eclipse.jetty.server.AbstractConnector Stopped ServerConnector@41d0b71d{HTTP/1.1,[http/1.1]}{0.0.0.0:8181}
nifi_1 | 2018-11-02 12:49:47,823 INFO [Thread-1] org.eclipse.jetty.server.session Stopped scavenging
Upvotes: 3
Views: 1367
Reputation: 703
Mapping the flow.xml.gz
file does not seem to work (I tested with apache/nifi-1.8.0 and got the same result as you).
Mapping the entire /conf
directory into the container worked for me. Here is the docker-compose file I am using:
version: "3.5"
services:
nifi:
image: apache/nifi:1.8.0
ports:
- "8181:8080"
environment:
- NIFI_WEB_HTTP_HOST=0.0.0.0
volumes:
- ./conf:/opt/nifi/nifi-current/conf/
In this case, my local ./conf directory is an entire NiFi configuration directory, containing:
conf
├── authorizers.xml
├── bootstrap-notification-services.xml
├── bootstrap.conf
├── flow.xml.gz
├── logback.xml
├── login-identity-providers.xml
├── nifi.properties
├── state-management.xml
└── zookeeper.properties
If you do not already have a conf directory to use as a starting point, you can get it by copying it out of the convenience binaries provided by the Apache project corresponding to the version of the Docker image you are using. In my example, I used the conf directory from the nifi-1.8.0.zip available from nifi.apache.org. Note that some files in that directory are created in that directory by NiFi at runtime.
Upvotes: 3