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

.withDockerTlsVerify(true) invalid #2198

Open
landashu opened this issue Sep 11, 2023 · 1 comment
Open

.withDockerTlsVerify(true) invalid #2198

landashu opened this issue Sep 11, 2023 · 1 comment

Comments

@landashu
Copy link

When I configure the properties of DockerClientConfig, I set withDockerTlsVerify to false, but it will eventually become an https request when requesting Docker private libraries,Here is my code:

DockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder()
.withDockerHost("tcp://"+item.getServerIp()+":"+item.getListPort())
.withDockerTlsVerify(false)
.build();
DockerHttpClient httpClient = new ApacheDockerHttpClient.Builder()
.dockerHost(config.getDockerHost())
.maxConnections(5)
.connectionTimeout(Duration.ofSeconds(5))
.responseTimeout(Duration.ofSeconds(5))
.build();
DockerClient dockerClient = DockerClientImpl.getInstance(config, httpClient);
DockerManagerVO dockerManagerVO = new DockerManagerVO();
dockerManagerVO.setDockerClient(dockerClient);
DockerManager.put(item.getId(),dockerManagerVO);

DockerConfigFindVO dockerConfigFindVO = dockerConfigMapper.findById(data.getConfigId());=
authConfig
.withRegistryAddress(dockerConfigFindVO.getConfigUrl())
.withUsername(dockerConfigFindVO.getConfigUserName())
.withPassword(dockerConfigFindVO.getConfigPassword());

    dockerManagerVO.getDockerClient()
            .tagImageCmd(data.getImageId(), data.getNewImageName(), data.getNewTagName())
            .exec();

    dockerManagerVO.getDockerClient()
            .pushImageCmd(data.getNewImageName()+":"+data.getNewTagName())
            .withAuthConfig(authConfig)
            .start();

ffbdbbced6e2b87cdaf34606c83b831

@ondh
Copy link

ondh commented Mar 26, 2024

It's not the DockerClientConfig issue.
you need to edit /etc/docker/daemon.json on your docker host, add 10.240.30.93:5000 to "insecure-registries"

{
...
    "insecure-registries" : [ "10.240.30.93:5000" ]
...
}

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

2 participants