Tensorflow on Docker linux/amd64 on mac M1
@FrankyDBravo,
To utilize TensorFlow with GPU acceleration, the installation of the CUDA toolkit is essential. However, it's crucial to note that CUDA was developed by NVIDIA and is optimized for use with NVIDIA GPUs. 

As a result, it's not feasible to run TensorFlow on AMD GPUs. For a comprehensive list of CUDA-enabled GPU devices that are compatible with TensorFlow, please take a look at this [documentation](https://www.tensorflow.org/install/pip#hardware_requirements). 
For GPUs with unsupported CUDA® architectures, or to avoid JIT compilation from PTX, or to use different versions of the NVIDIA® libraries, see the [Linux build from source](https://www.tensorflow.org/install/source) guide.

https://discuss.tensorflow.org/t/does-tensorflow-support-amd-radeon-graphics-cards/18765/5

Also you are trying to install tensorflow v2.5 which is pretty old, please try to update for tensorflow latest stable v2.14 or v2.13 for the smooth installation. Thank you!


 Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62257">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62257">No</a>
 thanks for the follow up, However I had the same problem with tensorflow-cpu==2.5.0 
I actually don't care about using gpu, would like to use the cpu but I need to use that version in that docker Let me rephrase my question: Do you have any exemple of dockerFile for linux/amd64 ubuntu with tensorflow that works on macOS with ARM processor ?  Hi, Recently from past few versions, `TensorFlow` started supporting MacOS M1 in it's official release, you can use the latest `TensorFlow` version(2.14 as of now).

Or you can directly to `pip install tensorflow` on your M1, to get GPU support additionally you need to install `pip install tensorflow-metal` This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62257">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62257">No</a>
 indeed it will work fine on a mac M1, but it doesn't seem to work on a docker (linux/amd64 ubuntu:20.04) running on mac M1 I have the same problem. 
The reason why I wanted to run tensorflow on docker in the first place was so i can use actually use tf-models-original which can not be properly installed on the M1 Mac which i use.

If i use docker platform linux/amd64, I can actually build and run the image with tensorflow and tf-models-original. But as soon as I try to import the tf package the kernel dies because of illegal instructions. I guess this is because docker can not properly simulate the amd64 architecture.


I would really like to know if there is a way to make tf-models-original run in a way that is not overly complicated: i have heared things about installing it with no dependencies and then installing them separately (and using a special pyyaml version ... i think it was 5.3.1). I tried it and it failed at the step of installing tensorflow-text (which is a dependency) cause there was no available package.  

I would really appreciate some concrete steps to either install all relevant tf packages on M1 or a way to install them within docker so I can run them this way. With a base image with arm64 support and installing hdf5 and tensorflow things should work fine. Using an amd64 docker image resolved in core dump for me. Here is a slightly modified docker file that worked for me: (need to specify platform to be arm64. I even built it in a amd64 linux vm with qemu)
```FROM rockylinux:8.9.20231119
ENV BASE_DIR /home/nexus-rtcl-app
WORKDIR ${BASE_DIR}

USER root
#### Main starts
RUN dnf -y install epel-release
RUN dnf config-manager --set-enabled powertools
RUN yum -y update \
    && yum install -y wget curl unzip which time \
    && yum -y update \ 
    && dnf -y install gcc-c++ \
    && dnf -y install hdf5-devel

RUN dnf -y install python38-devel 

RUN ln -s /usr/bin/python3 /usr/local/bin/python

RUN python -m pip install -r trieste \
    && python -m pip install numpy \
    && python -m pip install urllib3==1.26.16 \
    && python -m pip install -U pip setuptools
```

image on dockerhub (it has a lil extra stuff for our project but could be used for a quick test): yusenz/nexus-bayes_opt:1.4

note: hdf5py team should have prebuilt wheels for arm but installer still wants to build from source for some reason that I am too lazy to figure out.

### Issue type

Bug

### Have you reproduced the bug with TensorFlow Nightly?

No

### Source

binary

### TensorFlow version

tf 2.5

### Custom code

No

### OS platform and distribution

Docker ubuntu:20.04

### Mobile device

_No response_

### Python version

3.8

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

I am trying to install tensorflow 2.5.0 on my docker  ubuntu:20.04. 
I am running this docker on a mac M1 (arm chip).
My code is simple : docker file:

`# Use the official Ubuntu 20.04 base image
FROM --platform=linux/amd64 ubuntu:20.04

RUN apt-get update && \
    apt-get install -y git python3.8=3.8.10* python3-pip libfreetype6-dev pkg-config && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 && \
    update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1

# Install the Python packages from requirements.txt
RUN pip3 install tensorflow==2.5.0
`

then running my docker image i have the following error if i try to import tensorflow:
`>>> import tensorflow
Illegal instruction
`

I tried different docker images, installing from whl files, etc.. all led to the same error.
Using bazel and installing from source fails after an hour in the process with some error on gcc

I set up Rosetta on Docker config as well.

Is it a known issue?


### Standalone code to reproduce the issue

```shell
# Use the official Ubuntu 20.04 base image
FROM --platform=linux/amd64 ubuntu:20.04

RUN apt-get update && \
    apt-get install -y git python3.8=3.8.10* python3-pip libfreetype6-dev pkg-config && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 && \
    update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1

# Install the Python packages from requirements.txt
RUN pip3 install tensorflow==2.5.0
```


### Relevant log output

_No response_