0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

docker(69)今日のdocker error: tar, wget

Last updated at Posted at 2019-10-01

tar

dockerを起動した。

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

Posix Test Suite docker downloads, tar, install
https://qiita.com/kaizen_nagoya/items/f1e24be04a2405ede00f

で記述したファイルをwgetで落としてきた。(その時のエラーは次の項目で記載)

bash
# 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してみた。

docker/ubuntu
# 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/
で書かれている方法を試した。

docker/ubuntu
# 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これはtarアーカイブのようには見えません
https://codeday.me/jp/qa/20190213/250300.html

docker/ubuntu
# 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

docker/ubuntu
# 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

docker/ubuntu
# 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

やっと解凍できた。

##暫定回避(work around)
macOSで解凍。

macOS
$ tar zxvf NP_distr.Z 

ファイル共有してmac側で解答すればエラーにならなかった。

wget

docker/ubuntu
# 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]

全く同じコマンドで、1度目はエラー、2度目はOK。

最後までおよみいただきありがとうございました。

いいね 💚、フォローをお願いします。

Thank you very much for reading to the last sentence.

Please press the like icon 💚 and follow me for your happy life.

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?