Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build in docker: can't find connection! #1047

Open
danergo opened this issue Jan 17, 2025 · 1 comment
Open

Build in docker: can't find connection! #1047

danergo opened this issue Jan 17, 2025 · 1 comment

Comments

@danergo
Copy link

danergo commented Jan 17, 2025

Describe the bug
Building in docker is NOT working!

Unable to find Docker connection:example/example_build:0.1

To Reproduce
Created and run a docker image with

docker run -it --name=example --mount type=bind,source=${PWD},target=/src example/example_build:0.1 bash

Expected behavior
Build in docker works.

Screenshots

Please see, "My docker" is my local instance of docker. Also, please see "example" is in running stage.
Image

In project's properties, I ticked "Build inside Docker image":
Image

However, when I try building, I got an error:
Unable to find Docker connection:example/example_build:0.1

Version Information (please complete the following information):

  • Ubuntu 24.04LTS
  • Eclipse Version: 2024-12 (4.34.0)
  • CDT Version: 11.6.1.202407022008
@danergo
Copy link
Author

danergo commented Jan 17, 2025

Unable to find Docker connection:{0}

Is showing up in
./launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/messages.properties for the ContainerCommandLauncher_pullerr_noConn constant.

ContainerCommandLauncher_pullerr_noConn:
Only in one single place this is used:
./launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchUtils.java:

    /**
     * Pull an Docker-Image if is not locally available.
     *
     * @param monitor A Monitor to show progress
     * @param connectionName The name of the connection
     * @param imageName The image to pull
     * @return Status.OK on success, Status.CANCEL_STATUS if cancelled, and Status.ERROR if an error occurs
     *
     */
    public static @NonNull IStatus provideDockerImage(IProgressMonitor monitor, @NonNull final String connectionName,
            @NonNull String imageName) {

        // Try to pull image, if necessary
        final var connection = (IDockerConnection4) DockerConnectionManager.getInstance()
                .getConnectionByName(connectionName);

        if (connection == null) {
            // This is unlikely to happen, but who knows
            return new Status(Status.ERROR, DockerLaunchUIPlugin.PLUGIN_ID,
                    NLS.bind(Messages.ContainerCommandLauncher_pullerr_noConn, imageName, connectionName));
        }
...

This is unlikely to happen, but who knows

Who knows? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant