Run jboss-cli after startup docker and service wildfly

0

I am trying create image docker container with Dockerfile. I need execute some commands with jboss-cli when docker container starts. To execute jboss-cli it is necessary that the wildfly service is running.

My Dockerfile:

FROM jboss/wildfly:latest

USER jboss

RUN /opt/jboss/wildfly/bin/add-user.sh admin admin --silent

CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"]

i tried use “&” at the end of the command to throw the service to background but occurs error.

How i run the standalone service in background and run another command with Dockerfile?