Closed12

Docker のシェルとか apt とか yum とか

$ cd /tmp

$ vi images

$ cat images

alpine
bash
busybox
centos
debian
fedora
golang
httpd
mailhog/mailhog
nginx
node
python
redis
ubuntu
$ docker run -it alpine bash

docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "bash": executable file not found in $PATH: unknown.
ERRO[0000] error waiting for container: context canceled
# which bash > /dev/null 2>&1 && echo 'bash' || echo 'sh'
$ cat images | xargs -Iimage docker run --rm image sh -c "echo -n image; which bash > /dev/null 2>&1 && echo ', bash' || echo ', sh'"

alpine, sh
bash, bash
busybox, sh
centos, sh
debian, bash
fedora, sh
golang, bash
httpd, bash
nginx, bash
node, bash
python, bash
redis, bash
ubuntu, bash
$ cat images | xargs -Iimage docker run --rm --platform=linux/x86_64 --entrypoint sh image -c "echo -n image; grep -w bash /etc/shells > /dev/null 2>&1 && echo ', bash' || echo ', sh'"

alpine, sh
bash, sh
busybox, sh
centos, bash
debian, bash
fedora, bash
golang, bash
httpd, bash
mailhog/mailhog, sh
nginx, bash
node, bash
python, bash
redis, bash
ubuntu, bash
$ cat images | xargs -Iimage docker run --rm --platform=linux/x86_64 --entrypoint sh image -c "echo image; ls /etc/*-release"

alpine
/etc/alpine-release
/etc/os-release
archlinux
/etc/arch-release
/etc/os-release
centos
/etc/centos-release
/etc/os-release
/etc/redhat-release
/etc/system-release
debian
/etc/os-release
fedora
/etc/fedora-release
/etc/os-release
/etc/redhat-release
/etc/system-release
ubuntu
/etc/lsb-release
/etc/os-release
oraclelinux:8.5
/etc/oracle-release
/etc/os-release
/etc/redhat-release
/etc/system-release
bash
/etc/alpine-release
/etc/os-release
golang
/etc/os-release
python
/etc/os-release
node
/etc/os-release
httpd
/etc/os-release
nginx
/etc/os-release
mailhog/mailhog
/etc/alpine-release
/etc/os-release
mysql:8.0
/etc/os-release
redis
/etc/os-release
jboss/keycloak
/etc/os-release
/etc/redhat-release
/etc/system-release
registry.access.redhat.com/ubi8/openjdk-11
/etc/os-release
/etc/redhat-release
/etc/system-release
$ docker run --rm --platform=linux/x86_64 --entrypoint sh centos -c "cat /etc/shells; echo '---'; ls /etc/*-release"

/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash
---
/etc/centos-release
/etc/os-release
/etc/redhat-release
/etc/system-release
image
$ cat images | xargs -Iimage ruby ~taggings/lang-box/sandbox/uml/inspect.rb image
{
  "image": {
    "name": "alpine",
    "platforms": [
      "amd64",
      "arm64"
    ],
    "entrypoint": "",
    "cmd": "/bin/sh"
  },
  "container": {
    "os": "alpine",
    "shell": "sh",
    "commands": [
      "apk update",
      "apk add"
    ]
  },
  "docker": {
    "inspect": "docker image inspect alpine",
    "layers": "docker image history --no-trunc alpine",
    "entry": "docker run  --rm --user root --interactive --tty --entrypoint=sh alpine",
    "service": "/bin/sh"
  },
  "log": {
    "operations": [
      "image pulled"
    ]
  }
}
{
  "image": {
    "name": "centos",
    "platforms": [
      "amd64",
      "arm64"
    ],
    "entrypoint": "",
    "cmd": "/bin/bash"
  },
  "container": {
    "os": "centos",
    "shell": "bash",
    "commands": [
      "yum update",
      "yum install",
      "dnf update",
      "dnf install"
    ]
  },
  "docker": {
    "inspect": "docker image inspect centos",
    "layers": "docker image history --no-trunc centos",
    "entry": "docker run  --rm --user root --interactive --tty --entrypoint=bash centos",
    "service": "/bin/bash"
  },
  "log": {
    "operations": [
      "image pulled"
    ]
  }
}
{
  "image": {
    "name": "debian",
    "platforms": [
      "amd64",
      "arm64"
    ],
    "entrypoint": "",
    "cmd": "bash"
  },
  "container": {
    "os": "debian",
    "shell": "bash",
    "commands": [
      "apt update",
      "apt install"
    ]
  },
  "docker": {
    "inspect": "docker image inspect debian",
    "layers": "docker image history --no-trunc debian",
    "entry": "docker run  --rm --user root --interactive --tty --entrypoint=bash debian",
    "service": "bash"
  },
  "log": {
    "operations": [
      "image pulled"
    ]
  }
}
{
  "image": {
    "name": "fedora",
    "platforms": [
      "amd64",
      "arm64"
    ],
    "entrypoint": "",
    "cmd": "/bin/bash"
  },
  "container": {
    "os": "fedora",
    "shell": "bash",
    "commands": [
      "yum update",
      "yum install",
      "dnf update",
      "dnf install"
    ]
  },
  "docker": {
    "inspect": "docker image inspect fedora",
    "layers": "docker image history --no-trunc fedora",
    "entry": "docker run  --rm --user root --interactive --tty --entrypoint=bash fedora",
    "service": "/bin/bash"
  },
  "log": {
    "operations": [
      "image pulled"
    ]
  }
}
{
  "image": {
    "name": "ubuntu",
    "platforms": [
      "amd64",
      "arm64"
    ],
    "entrypoint": "",
    "cmd": "bash"
  },
  "container": {
    "os": "ubuntu",
    "shell": "bash",
    "commands": [
      "apt update",
      "apt install"
    ]
  },
  "docker": {
    "inspect": "docker image inspect ubuntu",
    "layers": "docker image history --no-trunc ubuntu",
    "entry": "docker run  --rm --user root --interactive --tty --entrypoint=bash ubuntu",
    "service": "bash"
  },
  "log": {
    "operations": [
      "image pulled"
    ]
  }
}
{
  "image": {
    "name": "oraclelinux:8.5",
    "platforms": [
      "amd64",
      "arm64"
    ],
    "entrypoint": "",
    "cmd": "/bin/bash"
  },
  "container": {
    "os": "ol",
    "shell": "bash",
    "commands": [
      "yum update",
      "yum install",
      "dnf update",
      "dnf install"
    ]
  },
  "docker": {
    "inspect": "docker image inspect oraclelinux:8.5",
    "layers": "docker image history --no-trunc oraclelinux:8.5",
    "entry": "docker run  --rm --user root --interactive --tty --entrypoint=bash oraclelinux:8.5",
    "service": "/bin/bash"
  },
  "log": {
    "operations": [
      "image pulled"
    ]
  }
}
{
  "image": {
    "name": "bash",
    "platforms": [
      "amd64",
      "arm64"
    ],
    "entrypoint": "docker-entrypoint.sh",
    "cmd": "bash"
  },
  "container": {
    "os": "alpine",
    "shell": "sh",
    "commands": [
      "apk update",
      "apk add"
    ]
  },
  "docker": {
    "inspect": "docker image inspect bash",
    "layers": "docker image history --no-trunc bash",
    "entry": "docker run  --rm --user root --interactive --tty --entrypoint=sh bash",
    "service": "docker-entrypoint.sh bash"
  },
  "log": {
    "operations": [
      "image pulled"
    ]
  }
}
{
  "image": {
    "name": "golang",
    "platforms": [
      "amd64",
      "arm64"
    ],
    "entrypoint": "",
    "cmd": "bash"
  },
  "container": {
    "os": "debian",
    "shell": "bash",
    "commands": [
      "apt update",
      "apt install"
    ]
  },
  "docker": {
    "inspect": "docker image inspect golang",
    "layers": "docker image history --no-trunc golang",
    "entry": "docker run  --rm --user root --interactive --tty --entrypoint=bash golang",
    "service": "bash"
  },
  "log": {
    "operations": [
      "image pulled"
    ]
  }
}
{
  "image": {
    "name": "rails",
    "platforms": [
      "amd64"
    ],
    "entrypoint": "",
    "cmd": "irb"
  },
  "container": {
    "os": "debian",
    "shell": "bash",
    "commands": [
      "apt update",
      "apt install"
    ]
  },
  "docker": {
    "inspect": "docker image inspect rails",
    "layers": "docker image history --no-trunc rails",
    "entry": "docker run --platform=linux/amd64 --rm --user root --interactive --tty --entrypoint=bash rails",
    "service": "irb"
  },
  "log": {
    "operations": [
      "amd64 specified",
      "image pulled"
    ]
  }
}
{
  "image": {
    "name": "node",
    "platforms": [
      "amd64",
      "arm64"
    ],
    "entrypoint": "docker-entrypoint.sh",
    "cmd": "node"
  },
  "container": {
    "os": "debian",
    "shell": "bash",
    "commands": [
      "apt update",
      "apt install"
    ]
  },
  "docker": {
    "inspect": "docker image inspect node",
    "layers": "docker image history --no-trunc node",
    "entry": "docker run  --rm --user root --interactive --tty --entrypoint=bash node",
    "service": "docker-entrypoint.sh node"
  },
  "log": {
    "operations": [
      "image pulled"
    ]
  }
}
{
  "image": {
    "name": "httpd",
    "platforms": [
      "amd64",
      "arm64"
    ],
    "entrypoint": "",
    "cmd": "httpd-foreground"
  },
  "container": {
    "os": "debian",
    "shell": "bash",
    "commands": [
      "apt update",
      "apt install"
    ]
  },
  "docker": {
    "inspect": "docker image inspect httpd",
    "layers": "docker image history --no-trunc httpd",
    "entry": "docker run  --rm --user root --interactive --tty --entrypoint=bash httpd",
    "service": "httpd-foreground"
  },
  "log": {
    "operations": [
      "image pulled"
    ]
  }
}
Traceback (most recent call last):
	6: from /Users/ryo/Dropbox/Taggings/lang-box/sandbox/uml/inspect.rb:63:in `<main>'
	5: from /Users/ryo/Dropbox/Taggings/lang-box/sandbox/uml/inspect.rb:63:in `each'
	4: from /Users/ryo/Dropbox/Taggings/lang-box/sandbox/uml/inspect.rb:64:in `block in <main>'
	3: from /Users/ryo/Dropbox/Taggings/lang-box/sandbox/uml/inspect.rb:29:in `inspect_image'
	2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/json/common.rb:335:in `load'
	1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/json/common.rb:156:in `parse'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/json/common.rb:156:in `parse': 416: unexpected token at '"-g" "daemon off;"]' (JSON::ParserError)
{
  "image": {
    "name": "minio/minio",
    "platforms": [
      "amd64"
    ],
    "entrypoint": "/usr/bin/docker-entrypoint.sh",
    "cmd": "minio"
  },
  "container": {
    "os": "rhel",
    "shell": "bash",
    "commands": [
      "microdnf update",
      "microdnf install"
    ]
  },
  "docker": {
    "inspect": "docker image inspect minio/minio",
    "layers": "docker image history --no-trunc minio/minio",
    "entry": "docker run --platform=linux/amd64 --rm --user root --interactive --tty --entrypoint=bash minio/minio",
    "service": "/usr/bin/docker-entrypoint.sh minio"
  },
  "log": {
    "operations": [
      "amd64 specified",
      "image pulled"
    ]
  }
}
{
  "image": {
    "name": "mailhog/mailhog",
    "platforms": [
      "amd64"
    ],
    "entrypoint": "MailHog",
    "cmd": "/bin/sh"
  },
  "container": {
    "os": "alpine",
    "shell": "sh",
    "commands": [
      "apk update",
      "apk add"
    ]
  },
  "docker": {
    "inspect": "docker image inspect mailhog/mailhog",
    "layers": "docker image history --no-trunc mailhog/mailhog",
    "entry": "docker run --platform=linux/amd64 --rm --user root --interactive --tty --entrypoint=sh mailhog/mailhog",
    "service": "MailHog /bin/sh"
  },
  "log": {
    "operations": [
      "amd64 specified"
    ]
  }
}
{
  "image": {
    "name": "redis",
    "platforms": [
      "amd64",
      "arm64"
    ],
    "entrypoint": "docker-entrypoint.sh",
    "cmd": "redis-server"
  },
  "container": {
    "os": "debian",
    "shell": "bash",
    "commands": [
      "apt update",
      "apt install"
    ]
  },
  "docker": {
    "inspect": "docker image inspect redis",
    "layers": "docker image history --no-trunc redis",
    "entry": "docker run  --rm --user root --interactive --tty --entrypoint=bash redis",
    "service": "docker-entrypoint.sh redis-server"
  },
  "log": {
    "operations": [
      "image pulled"
    ]
  }
}
{
  "image": {
    "name": "jboss/keycloak",
    "platforms": [
      "amd64"
    ],
    "entrypoint": "/opt/jboss/tools/docker-entrypoint.sh",
    "cmd": "-b 0.0.0.0"
  },
  "container": {
    "os": "rhel",
    "shell": "bash",
    "commands": [
      "microdnf update",
      "microdnf install"
    ]
  },
  "docker": {
    "inspect": "docker image inspect jboss/keycloak",
    "layers": "docker image history --no-trunc jboss/keycloak",
    "entry": "docker run --platform=linux/amd64 --rm --user root --interactive --tty --entrypoint=bash jboss/keycloak",
    "service": "/opt/jboss/tools/docker-entrypoint.sh -b 0.0.0.0"
  },
  "log": {
    "operations": [
      "amd64 specified"
    ]
  }
}
{
  "image": {
    "name": "registry.access.redhat.com/ubi8/openjdk-11",
    "platforms": [
      "amd64"
    ],
    "entrypoint": "",
    "cmd": ""
  },
  "container": {
    "os": "rhel",
    "shell": "bash",
    "commands": [
      "microdnf update",
      "microdnf install"
    ]
  },
  "docker": {
    "inspect": "docker image inspect registry.access.redhat.com/ubi8/openjdk-11",
    "layers": "docker image history --no-trunc registry.access.redhat.com/ubi8/openjdk-11",
    "entry": "docker run --platform=linux/amd64 --rm --user root --interactive --tty --entrypoint=bash registry.access.redhat.com/ubi8/openjdk-11",
    "service": ""
  },
  "log": {
    "operations": [
      "amd64 specified",
      "image pulled"
    ]
  }
}
{
  "image": {
    "name": "redhat/ubi8",
    "platforms": [
      "amd64"
    ],
    "entrypoint": "",
    "cmd": ""
  },
  "container": {
    "os": "rhel",
    "shell": "bash",
    "commands": [
      "yum update",
      "yum install",
      "dnf update",
      "dnf install"
    ]
  },
  "docker": {
    "inspect": "docker image inspect redhat/ubi8",
    "layers": "docker image history --no-trunc redhat/ubi8",
    "entry": "docker run --platform=linux/amd64 --rm --user root --interactive --tty --entrypoint=bash redhat/ubi8",
    "service": ""
  },
  "log": {
    "operations": [
      "amd64 specified",
      "image pulled"
    ]
  }
}
docker image rm `cat images | tr '\n' ' '`
images = ['alpine', 'centos', 'debian', 'fedora', 'ubuntu', 'oraclelinux:8.5', 'bash', 'golang', 'rails', 'node', 'httpd', 'nginx', 'minio/minio', 'mailhog/mailhog', 'redis', 'jboss/keycloak', 'registry.access.redhat.com/ubi8/openjdk-11', 'redhat/ubi8']

images.each { |image|
  puts ":::details #{image}"
  puts "```txt:#{image} の結果"
  puts `ruby /Users/ryo/Dropbox/Taggings/lang-box/sandbox/uml/inspect.rb #{image}`
  puts "```"
  puts ":::"
}
このスクラップは5ヶ月前にクローズされました
ログインするとコメントできます