今天遇到的Docker错误是关于tar和wget的

焦油

我启动了 Docker。

$ docker run -v /Users/ogawakiyoshi/work:/Users/ogawakiyoshi/work -it gcc /bin/bash

以下为中文语义的同义译文:

下载 Posix 测试套件 Docker 文件包,并进行 tar 解压和安装。
https://qiita.com/kaizen_nagoya/items/f1e24be04a2405ede00f

我用wget下载了以前写的文件。(关于那次错误的详情,请参见下一项)

# apt update; apt -y upgrade

# tar --version
tar (GNU tar) 1.30
Copyright (C) 2017 Free Software Foundation, Inc.
# tar zxvf NP_distr.Z 
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors

# tar zxvf NP_distr.Z 

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

当在CentOS系统中执行tar命令打包时,如果出现“This does not look like a tar archive”提示,请按以下方式解决:

 

我试着解压缩了一下。

# unzip --version
caution:  both -n and -o specified; ignoring -o
UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.
# unzip NP_distr.Z 
Archive:  NP_distr.Z
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of NP_distr.Z or
        NP_distr.Z.zip, and cannot find NP_distr.Z.ZIP, period.

我尝试了在《Linux命令列表(.zip .gz .Z .bz2 tar.gz .tgz tar.Z .taz .tar.bz2 .tbz2)》(https://webkaru.net/linux/compress-uncompress-command-list/)中介绍的文件解压缩方法。

# ls
NP_distr.Z

# tar -xfZ NP_distr.Z 
tar: Z: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

# tar xfZ NP_distr.Z 
tar (child): compress: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

这似乎不像是一个tar存档

# gzip --version
gzip 1.9
Copyright (C) 2017 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.

# gzip -dc NP_distr.Z | tar -xf -
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors

各文件扩展名的压缩和解压方法列表
https://www.server-memo.net/tips/compress-list.html

# uncompress --version
gunzip (gzip) 1.9
Copyright (C) 2007, 2011-2017 Free Software Foundation, Inc.
# uncompress -v NP_distr.Z 
NP_distr.Z:	 69.9% -- replaced with NP_distr
# ls -al
total 3688
drwxr-xr-x 2 root root    4096 Oct  6 08:59 .
drwxr-xr-x 1 root root    4096 Oct  6 07:25 ..
-rw-r--r-- 1 root root 3768320 Oct  1 12:36 NP_distr

只是更改了文件名。你能做些什么啊?

Ubuntu上使用带密码的7zip压缩工具
https://qiita.com/3attoC/items/8b10359fd0fbe7860031

# apt install -y p7zip-full
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package p7zip-full

# apt update; apt -y upgrade

# apt install -y p7zip-full
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  p7zip
Suggested packages:
  p7zip-rar
The following NEW packages will be installed:
  p7zip p7zip-full
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 1540 kB of archives.
After this operation, 5780 kB of additional disk space will be used.

# 7z x NP_distr.Z 

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=C,Utf16=off,HugeFiles=on,64 bits,2 CPUs Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz (40651),ASM,AES-NI)

Scanning the drive for archives:
1 file, 3768320 bytes (3680 KiB)

Extracting archive: NP_distr.Z
             
WARNINGS:
There are data after the end of archive

WARNING:
NP_distr.Z
Can not open the file as [Z] archive
The file is open as [Cpio] archive

--
Path = NP_distr.Z
Open WARNING: Can not open the file as [Z] archive
Type = Cpio
WARNINGS:
There are data after the end of archive
Physical Size = 3766423
Tail Size = 1897
SubType = Portable ASCII

Everything is Ok                                   

Archives with Warnings: 1

Warnings: 1
Folders: 428
Files: 1928
Size:       3499376
Compressed: 3768320

终于解冻了。

先前的工作
先前的工作

$ tar zxvf NP_distr.Z 

如果在Mac端进行文件共享并解答,则不会出错。

请使用wget。

# wget http://www.itl.nist.gov/div897/ctg/suites/ITG.ps
URL transformed to HTTPS due to an HSTS policy
--2019-10-01 12:30:46--  https://www.itl.nist.gov/div897/ctg/suites/ITG.ps
Resolving www.itl.nist.gov (www.itl.nist.gov)... 132.163.4.36, 2610:20:6005:13::51, 2610:20:6b01:4::36
Connecting to www.itl.nist.gov (www.itl.nist.gov)|132.163.4.36|:443... connected.
GnuTLS: The TLS connection was non-properly terminated.
Unable to establish SSL connection.

# wget http://www.itl.nist.gov/div897/ctg/suites/ITG.ps
URL transformed to HTTPS due to an HSTS policy
--2019-10-01 12:34:19--  https://www.itl.nist.gov/div897/ctg/suites/ITG.ps
Resolving www.itl.nist.gov (www.itl.nist.gov)... 132.163.4.36, 2610:20:6005:13::51, 2610:20:6b01:4::36
Connecting to www.itl.nist.gov (www.itl.nist.gov)|132.163.4.36|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 181136 (177K) [application/postscript]
Saving to: 'ITG.ps'

ITG.ps                     100%[======================================>] 176.89K   217KB/s    in 0.8s    

2019-10-01 12:34:21 (217 KB/s) - 'ITG.ps' saved [181136/181136]

完全相同的命令,第一次出错,第二次正常。

最后感谢您阅读到最后。

喜欢的话,可以请您关注一下吗??

非常感谢您阅读到最后一句话。

请点击喜欢的图标?并关注我,为您带来快乐的生活。