崩溃docker-compose dockerpycreds.errors.InitializationError

时间:2019-01-13 23:05:19

标签: docker docker-compose ubuntu-18.04

docker-compose version的输出

docker-compose version 1.23.2, build 1110ad0
docker-py version: 3.7.0
CPython version: 2.7.15rc1
OpenSSL version: OpenSSL 1.1.0g  2 Nov 2017

docker version的输出

Client:
 Version:           18.09.1
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        4c52b90
 Built:             Wed Jan  9 19:35:31 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.1
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       4c52b90
  Built:            Wed Jan  9 19:02:44 2019
  OS/Arch:          linux/amd64
  Experimental:     false

docker-compose config的输出

services:
  my-test:
    image: hello-world
    network_mode: bridge
version: '2.1'

Stacktrace /完整错误消息:

root@home-bot:~/temp# docker-compose up
Pulling my-test (hello-world:)...
Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 71, in main
    command()
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 127, in perform_command
    handler(command, command_options)
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 1080, in up
    to_attach = up(False)
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 1076, in up
    silent=options.get('--quiet-pull'),
  File "/usr/local/lib/python2.7/dist-packages/compose/project.py", line 475, in up
    svc.ensure_image_exists(do_build=do_build, silent=silent)
  File "/usr/local/lib/python2.7/dist-packages/compose/service.py", line 352, in ensure_image_exists
    self.pull(silent=silent)
  File "/usr/local/lib/python2.7/dist-packages/compose/service.py", line 1217, in pull
    return progress_stream.get_digest_from_pull(event_stream)
  File "/usr/local/lib/python2.7/dist-packages/compose/progress_stream.py", line 101, in get_digest_from_pull
    for event in events:
  File "/usr/local/lib/python2.7/dist-packages/compose/service.py", line 1182, in _do_pull
    output = self.client.pull(repo, **pull_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/docker/api/image.py", line 381, in pull
    header = auth.get_config_header(self, registry)
  File "/usr/local/lib/python2.7/dist-packages/docker/auth.py", line 48, in get_config_header
    client._auth_configs, registry, credstore_env=client.credstore_env
  File "/usr/local/lib/python2.7/dist-packages/docker/auth.py", line 322, in resolve_authconfig
    return authconfig.resolve_authconfig(registry)
  File "/usr/local/lib/python2.7/dist-packages/docker/auth.py", line 235, in resolve_authconfig
    cfg = self._resolve_authconfig_credstore(registry, store_name)
  File "/usr/local/lib/python2.7/dist-packages/docker/auth.py", line 262, in _resolve_authconfig_credstore
    store = self._get_store_instance(credstore_name)
  File "/usr/local/lib/python2.7/dist-packages/docker/auth.py", line 287, in _get_store_instance
    name, environment=self._credstore_env
  File "/usr/local/lib/python2.7/dist-packages/dockerpycreds/store.py", line 25, in __init__
    self.program
dockerpycreds.errors.InitializationError: docker-credential-osxkeychain not installed or not available in PATH

其他信息 操作系统版本/发行版: Ubuntu 18.04.1 LTS(GNU / Linux 4.15.0-43-通用x86_64)

4 个答案:

答案 0 :(得分:2)

我有同样的问题。我仍在调查,但临时解决方法是删除您家中的docker配置

TempVar

答案 1 :(得分:2)

我在GCE中运行docker compose。

删除~/.docker/config.json对我有用。

答案 2 :(得分:1)

对于 me 安装缺少的工具修复了问题:

sudo apt install golang-docker-credential-helpers

答案 3 :(得分:0)

也有可能在import org.apache.commons.compress.archivers.zip.*; import org.apache.commons.compress.parallel.InputStreamSupplier; import org.apache.commons.io.FileUtils; import java.io.*; import java.nio.file.Files; import java.util.Iterator; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class ZipMain { static ParallelScatterZipCreator scatterZipCreator = new ParallelScatterZipCreator(); static ScatterZipOutputStream dirs; static { try { dirs = ScatterZipOutputStream.fileBased(File.createTempFile("java-zip-dirs", "tmp")); } catch (IOException e) { e.printStackTrace(); } } public static void main(String[] args) throws IOException { String sourceFolder = "/Users/<user>/Desktop/"; String zipFilePath = "/Users/<user>/Desktop/Desk.zip"; String fileTypesToBeAddedToZip = "txt"; zip(sourceFolder, zipFilePath, fileTypesToBeAddedToZip); unzip(zipFilePath, sourceFolder + "/unzip/"); } private static void zip(String sourceFolder, String zipFilePath, String fileTypesToBeAddedToZip) throws IOException { OutputStream outputStream = null; ZipArchiveOutputStream zipArchiveOutputStream = null; try { File srcFolder = new File(sourceFolder); if (srcFolder.isDirectory()) { // uncomment following code if you want to add all files under srcFolder //Iterator<File> fileIterator = Arrays.asList(srcFolder.listFiles()).iterator(); Iterator<File> fileIterator = FileUtils.iterateFiles(srcFolder, new String[]{fileTypesToBeAddedToZip}, true); File zipFile = new File(zipFilePath); zipFile.delete(); outputStream = new FileOutputStream(zipFile); zipArchiveOutputStream = new ZipArchiveOutputStream(outputStream); zipArchiveOutputStream.setUseZip64(Zip64Mode.AsNeeded); int srcFolderLength = srcFolder.getAbsolutePath().length() + 1; // +1 to remove the last file separator while (fileIterator.hasNext()) { File file = fileIterator.next(); // uncomment following code if you want to add all files under srcFolder //if (file.isDirectory()) { // continue; // } String relativePath = file.getAbsolutePath().substring(srcFolderLength); InputStreamSupplier streamSupplier = () -> { InputStream is = null; try { is = Files.newInputStream(file.toPath()); } catch (IOException e) { e.printStackTrace(); } return is; }; ZipArchiveEntry zipArchiveEntry = new ZipArchiveEntry(relativePath); zipArchiveEntry.setMethod(ZipEntry.DEFLATED); scatterZipCreator.addArchiveEntry(zipArchiveEntry, streamSupplier); } scatterZipCreator.writeTo(zipArchiveOutputStream); } if (zipArchiveOutputStream != null) { zipArchiveOutputStream.close(); } } catch (Exception e) { e.printStackTrace(); } finally { if (outputStream != null) { outputStream.close(); } } } private static void unzip(String zipFilePath, String destDir) { File dir = new File(destDir); // create output directory if it doesn't exist if (!dir.exists()) { dir.mkdirs(); } else { dir.delete(); } FileInputStream fis; //buffer for read and write data to file byte[] buffer = new byte[1024]; try { fis = new FileInputStream(zipFilePath); ZipInputStream zis = new ZipInputStream(fis); ZipEntry ze = zis.getNextEntry(); while (ze != null) { String fileName = ze.getName(); File newFile = new File(destDir + File.separator + fileName); System.out.println("Unzipping to " + newFile.getAbsolutePath()); //create directories for sub directories in zip String parentFolder = newFile.getParent(); File folder = new File(parentFolder); folder.mkdirs(); FileOutputStream fos = new FileOutputStream(newFile); int len; while ((len = zis.read(buffer)) > 0) { fos.write(buffer, 0, len); } fos.close(); //close this ZipEntry zis.closeEntry(); ze = zis.getNextEntry(); } //close last ZipEntry zis.closeEntry(); zis.close(); fis.close(); } catch (IOException e) { e.printStackTrace(); } } } 中将Docker客户端的"credStore"设置为"osxkeychain"

链接问题: https://github.com/docker/compose/issues/6458#issuecomment-454064994