Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Vanilla local install of dispatcher throwing "to was unexpected at this time." error on startup attempt

Avatar

Level 2

Hello, I'm starting my journey, so I don't know much about AEM. I'm trying to setup the local environment to run some tutorials on Windows 11. Following the installation guide at https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/local-development-env... . I've unzipped the dispatcher files and trying to run it with:

bin\docker_run src host.docker.internal:4503 8080

This exits with a message like in the subject.

I tried running the validator beforehand, tried 2 different unzip tools, tried to run as administrator, no difference.

When I skip the port number it shows me the usage message, as expected.

I'm a little stuck here, please any pointers?

 

btw, docker is running, I can use docker cmd line.

 

-Voytek

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 2

For completeness, I got things to work by modifying the 'bin\docker_run.cmd' script as follows:

I removed these lines:

 

for /F "tokens=* USEBACKQ" %%f in (`docker images -q %imageurl%`) do (
    set location=%%f
)

 

This results in suboptimal performance on startup, as the image get's re-loaded into docker registry on every startup instead of being re-used, but for the sake of running my tutorials this is not an issue.

View solution in original post

10 Replies

Avatar

Level 4

Hello @WojtekMu 

 

The error message you're receiving usually means that the container 'httpd' is trying to bind to a port that's already in use by another process on your system.

 

You may have another service already running on port 8080 on your system -

netstat -ano | findstr :8080 use this command to check which program is using this port. It will return something like TCP [::]:8080 [::]:0 LISTENING <PID>.

 

tasklist|findstr <PID> use this to kill the task.

 

Try running the Docker run command with the --rm tag. This will make sure the container is removed when it exits or when Docker is restarted -- bin\docker_run --rm src host.docker.internal:4503 8080

 

If all of the above fail, you probably have another instance of Docker running the same container that's not exited cleanly. Try running docker container ls -a to see all containers (even those not running), and remove any that are using the same image with docker rm <CONTAINER_ID>

 

Hope this helps.

 

Thanks,

Venkat

Avatar

Level 2

Thank you for response. I tried the few things you suggested, but it seems the problem might be something different. Here is the output of the commands:

C:\Users\wojtek\aem-sdk\dispatcher>bin\docker_run src host.docker.internal:4503 8080
to was unexpected at this time.

C:\Users\wojtek\aem-sdk\dispatcher>netstat -ano | findstr :8080
  TCP    192.168.1.212:53199    165.225.226.27:8080    TIME_WAIT       0
  TCP    192.168.1.212:53268    165.225.226.27:8080    TIME_WAIT       0
  TCP    192.168.1.212:53271    147.161.218.28:8080    TIME_WAIT       0
  TCP    192.168.1.212:53334    165.225.226.27:8080    TIME_WAIT       0
  TCP    192.168.1.212:53337    147.161.218.28:8080    TIME_WAIT       0
  TCP    192.168.1.212:53370    165.225.226.27:8080    TIME_WAIT       0
  TCP    192.168.1.212:53376    147.161.218.28:8080    TIME_WAIT       0

C:\Users\wojtek\aem-sdk\dispatcher>docker image ls --all
REPOSITORY   TAG       IMAGE ID       CREATED      SIZE
ubuntu       latest    ca2b0f26964c   7 days ago   77.9MB

C:\Users\wojtek\aem-sdk\dispatcher>docker container ls --all
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

C:\Users\wojtek\aem-sdk\dispatcher>

This would suggest to me there is nothing bound to the port 8080, also there are no containers and the only image is ubuntu. This really is a rather vanilla setup. Any other ideas? Any logfiles I could look at for investigation?

 

Cheers.

Avatar

Level 2

Thanks for all your suggestions so far. I pretty much followed them exactly always getting the same error result every time.

But now I've managed to narrow it down a little, by logging the 'docker_run,cmd' execution. It fails on the following line:

for /F "tokens=* USEBACKQ" %f in (`docker images -q adobe/aem-cs/dispatcher-publish:2.0.193`) do (set location=%f )

When I run the docker command from the above by hand it returns nothing. When I login to docker hub and look for adobe/aem-cs images I get no matches. Why could that be?

Avatar

Level 2

Ok, I know even more now. That image isn't supposed to exist on docker hub. The script is meant to ignore the blank result and load the image from a 'lib' subdirectory. Unfortunately the 'for' command I quoted previously behaves not as expected. I see this in the batch script output:

 

C:\Users\wojtek\aem-sdk\dispatcher>for /F "tokens=* USEBACKQ" %f in (`docker images -q adobe/aem-cs/dispatcher-publish:2.0.193`) do (set location=%f )

C:\Users\wojtek\aem-sdk\dispatcher>(set location=failed to get console mode for stdout: The handle is invalid. )

C:\Users\wojtek\aem-sdk\dispatcher>rem Load docker file
to was unexpected at this time.

C:\Users\wojtek\aem-sdk\dispatcher>if [failed to get console mode for stdout: The handle is invalid.] equ [] (

C:\Users\wojtek\aem-sdk\dispatcher>

 

Note the `set location=failed to get console .....` line. This is where things start to go wrong.

My conclusion would be that this batch script has an issue. Perhaps it's backwards compatibility problem with windows 11?

 

Avatar

Administrator

@WojtekMu Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni

Avatar

Level 2

No, unfortunately none of the suggestions fixed my problems. I found a workaround by modifying the "docker_run.cmd" temporarily, but I wouldn't call this a proper fix.

Avatar

Level 3

Hi @WojtekMu The error message you're encountering is due to the incorrect syntax of the command you're using to run the Docker image. The correct syntax should be:

bin\docker_run.bat src host.docker.internal:4503 8080

 

or bin/docker_run.sh src host.docker.internal:4503 8080

depending on whether you're using Windows or Linux/MacOS.

If you're using Windows, you should run the command in the Command Prompt or PowerShell.

If you're using Linux/MacOS, you should run the command in the Terminal.

Make sure to replace host.docker.internal with your actual AEM instance URL if you're not using the default AEM instance.

If you're still encountering issues, ensure that Docker is running and that you have the necessary permissions to run Docker commands.

If you're using Windows, you might need to run the command prompt or PowerShell as an administrator.

If you're using Linux/MacOS, you might need to run the command with sudo if you don't have the necessary permissions.

If you're still encountering issues, you might want to try reinstalling Docker or the AEM Dispatcher Docker image.

 

Please note that the host.docker.internal hostname is a special DNS entry that resolves to the host machine's IP address. This is particularly useful for communicating between containers and the host machine.

If you're using Docker for Windows, the host.docker.internal hostname should work as expected. However, if you're using Docker for Mac or Docker for Linux, you might need to use the IP address of your host machine instead. You can find this IP address by running ipconfig on Windows or ifconfig on Linux/MacOS.

For example, if your host machine's IP address is 192.168.1.100, you would use:

bin\docker_run.bat src 192.168.1.100:4503 8080

or bin/docker_run.sh src 192.168.1.100:4503 8080

depending on your operating system. 

Avatar

Level 2

I'm afraid all your suggestions mean you might have missed some of my updates.

Everything works if I comment out the "for loop" checking the docker image existence inside the docker_run.cmd .


Avatar

Correct answer by
Level 2

For completeness, I got things to work by modifying the 'bin\docker_run.cmd' script as follows:

I removed these lines:

 

for /F "tokens=* USEBACKQ" %%f in (`docker images -q %imageurl%`) do (
    set location=%%f
)

 

This results in suboptimal performance on startup, as the image get's re-loaded into docker registry on every startup instead of being re-used, but for the sake of running my tutorials this is not an issue.