<p>Asked on the Docker forums - apparently to correctly &quot;import&quot; the image, you don't user the <code>import</code> command but instead user <code>image load</code> command.</p>
<p>INCORRECT:</p>
<pre><code>$ docker image save local/ubuntu:latest -o ubuntu.tgz # on Ubuntu 20
$ docker import ubuntu.tgz local/ubuntu:latest        # WRONG! on Ubuntu 21
</code></pre>
<p><strong>CORRECT:</strong></p>
<pre><code>$ docker image save local/ubuntu:latest -o ubuntu.tgz # on Ubuntu 20
$ docker image load -i ubuntu.tgz                     # on Ubuntu 21
</code></pre>
<p>Credits go to the person who <a href="https://forums.docker.com/t/same-image-refuses-to-run-on-ubuntu-21-but-runs-on-ubuntu-20-docker-versions-are-the-same/121955" rel="nofollow noreferrer">answered this question</a> on the Docker forum here. Also note, that if you run <code>docker image save</code> the image full name (<code>repo/name:tag</code>) is actually save with along with other information, so upon running <code>docker image load -i ubuntu.tgz</code> Docker will tag that image as exactly as it was tagged when it was saved. If an image with the same name exists, it will be replaced, so be careful.</p>

CC BY-SA 4.0
2022-03-19T18:00:20.803Z
2022-03-19T18:00:20.803Z
TheProtagonist
<p>So I've pulled the amd64/ubuntu:latest image, which is an Ubuntu 20 image for docker and customized it a bit. Not much - zsh, vim, locales and openssh-server compiled from source (because the package wants me to download 100Mb of some stuff, whereas the compiled version is only 1.5 Mb)</p>
<p>In this case, I don't think those are the reason for the following problem: I did not intend to use Dockerfiles with this one, and I created and ran containers with the following command:</p>
<pre><code>$ docker run -dit --network=my_docker_network --name=MyContainer \
  local/ubuntu:latest
</code></pre>
<p>This works fine on my Ubuntu 20.04 - notice how there isn't a command after the image name, which, as per documentation, is supposed to be there, but it looks like it isn't needed here. The <code>sshd</code> is later started manually by the <code>docker exec</code> command and works fine.</p>
<p>Now, to test the compatibility, I've installed Ubuntu 21 on a VirtualBox, then installed docker there and imported my custom image <code>local/ubuntu:latest</code>. Docker versions and the way they are run seem to be exactly the same - v20.10.12. When I run the same <code>docker run...</code> command on Ubuntu 21, it refuses to start start the image, saying another argument - the COMMAND - is require. Yet when I provide ANY command as the last argument, for example:</p>
<pre><code>$ docker run -dit --network=my_docker_network --name=MyContainer \
  local/ubuntu:latest /usr/bin/sh -c 'echo OK'
</code></pre>
<p>or</p>
<pre><code>$ docker run -dit --network=my_docker_network --name=MyContainer \
  local/ubuntu:latest /usr/bin/sshd
</code></pre>
<p>it says they're not in $PATH or file doesn't exist.</p>
<p>If I try and create a container first, it is indeed created with:</p>
<pre><code>$ docker create -it --network=my_docker_network --name=MyContainer \
  local/ubuntu:latest
</code></pre>
<p>But the same problem occurs once I try actually starting it. What is this? What am I missing?</p>

<docker><ubuntu>
Docker refuses to execute commands or start containers with Ubuntu 20 image on Ubuntu 21 host, but works on Ubuntu 20 host
TheProtagonist
# Docker refuses to execute commands or start containers with Ubuntu 20 image on Ubuntu 21 host, but works on Ubuntu 20 host

(Asked by: username_0 on 2022-03-06)

So I've pulled the amd64/ubuntu:latest image, which is an Ubuntu 20 image for docker and customized it a bit. Not much - zsh, vim, locales and openssh-server compiled from source (because the package wants me to download 100Mb of some stuff, whereas the compiled version is only 1.5 Mb)
In this case, I don't think those are the reason for the following problem: I did not intend to use Dockerfiles with this one, and I created and ran containers with the following command:
$ docker run -dit --network=my_docker_network --name=MyContainer \
  local/ubuntu:latest

This works fine on my Ubuntu 20.04 - notice how there isn't a command after the image name, which, as per documentation, is supposed to be there, but it looks like it isn't needed here. The sshd is later started manually by the docker exec command and works fine.
Now, to test the compatibility, I've installed Ubuntu 21 on a VirtualBox, then installed docker there and imported my custom image local/ubuntu:latest. Docker versions and the way they are run seem to be exactly the same - v20.10.12. When I run the same docker run... command on Ubuntu 21, it refuses to start start the image, saying another argument - the COMMAND - is require. Yet when I provide ANY command as the last argument, for example:
$ docker run -dit --network=my_docker_network --name=MyContainer \
  local/ubuntu:latest /usr/bin/sh -c 'echo OK'

or
$ docker run -dit --network=my_docker_network --name=MyContainer \
  local/ubuntu:latest /usr/bin/sshd

it says they're not in $PATH or file doesn't exist.
If I try and create a container first, it is indeed created with:
$ docker create -it --network=my_docker_network --name=MyContainer \
  local/ubuntu:latest

But the same problem occurs once I try actually starting it. What is this? What am I missing?

**Tags:** docker, ubuntu


---

## 1 answers

### Answer by username_0 on 2022-03-19. Score: 1 | Accepted answer

Asked on the Docker forums - apparently to correctly "import" the image, you don't user the import command but instead user image load command.
INCORRECT:
$ docker image save local/ubuntu:latest -o ubuntu.tgz # on Ubuntu 20
$ docker import ubuntu.tgz local/ubuntu:latest        # WRONG! on Ubuntu 21

CORRECT:
$ docker image save local/ubuntu:latest -o ubuntu.tgz # on Ubuntu 20
$ docker image load -i ubuntu.tgz                     # on Ubuntu 21

Credits go to the person who answered this question on the Docker forum here. Also note, that if you run docker image save the image full name (repo/name:tag) is actually save with along with other information, so upon running docker image load -i ubuntu.tgz Docker will tag that image as exactly as it was tagged when it was saved. If an image with the same name exists, it will be replaced, so be careful.


---

