I'm a newbie to VM and Docker containers.
I tried to create a docker container with a python app using Tensorflow 2.10 dependency (and some other libraries)
Host: windows 11 Pro
GPU: RTX3070 Laptop
Guest: Ubuntu 22.4 LTS
VM: 6.1.4
Docker: Docker version 20.10.17, build 100c70180f
This is the output of the build process.
Sending build context to Docker daemon 15.6MB
Step 1/10 : FROM python:3.8-slim-buster
---> 5f3ce1d922f0
Step 2/10 : RUN mkdir -p /home/finance_analysis
---> Using cache
---> cf0e3e5db616
Step 3/10 : WORKDIR /home/finance_analysis
---> Using cache
---> e7106cfd59ef
Step 4/10 : RUN groupadd -r group && useradd -g group user
---> Using cache
---> 8a38c429faca
Step 5/10 : RUN chown -R user:group /home/finance_analysis
---> Using cache
---> bbf5a7d24d25
Step 6/10 : COPY requirements.txt requirements.txt
---> Using cache
---> 7165d444e895
Step 7/10 : RUN pip3 install -r requirements.txt
---> Using cache
---> ceb7ebba9465
Step 8/10 : COPY . /home/finance_analysis
---> f4c54500cbe5
Step 9/10 : USER user
---> Running in 0be3e1fc4f83
Removing intermediate container 0be3e1fc4f83
---> bb5fa2aa9954
Step 10/10 : CMD ["python3", "main.py"]
---> Running in a2f4ed4cddca
Removing intermediate container a2f4ed4cddca
---> bac6188bdd4c
Successfully built bac6188bdd4c
Successfully tagged fa:1.0
When I run the the container I get this error message:
he TensorFlow library was compiled to use AVX instructions, but these aren't available on your machine.
Aborted (core dumped)
Please let me know if there is anything else I forgot to mention.
Thanks.
I tried to use a wheel of Tensorflow 2.3 without AVX instructions but it didn't work.
Related
I have a working build that I am trying to dockerise. This is my dockerfile, I added the "pwd" and "ls -l" to see if the build is copied correctly and it is. However when I try to run "docker run " I get the error "No such file or directory. Please let me know what I might be doing wrong. Appreciate your help.
Dockerfile
FROM <base image>
WORKDIR /app
RUN echo 'List all files'
RUN pwd
RUN ls -l
COPY src/mysolution-linux-amd64 /app/
RUN ls -l
ENTRYPOINT ["/app/mysolution-linux-amd64"]
I have tried ENTRYPOINT with both "./mysolution-linux-amd64" and "/app/mysolution-linux-amd64" but both fail when I run.
Output during Docker build
Sending build context to Docker daemon 1.014GB
Step 1/8 : FROM <base image>
---> 3ed27f7c19ce
Step 2/8 : WORKDIR /app
---> Running in 1b273ccccd22
Removing intermediate container 1b273ccccd22
---> 92560bbb67eb
Step 3/8 : RUN echo 'List all files'
---> Running in faddc1b6adfd
List all files
Removing intermediate container faddc1b6adfd
---> b7b2f657012e
Step 4/8 : RUN pwd
---> Running in 8354a5a476ac
/app
Removing intermediate container 8354a5a476ac
---> 204a625b730b
Step 5/8 : RUN ls -l
---> Running in 0d45cf1339d9
total 0
Removing intermediate container 0d45cf1339d9
---> 6df6451aef44
Step 6/8 : COPY src/mysolution-linux-amd64 /app/
---> 44ac2f066340
Step 7/8 : RUN ls -l
---> Running in d17ec6b0c7af
total 11460
-rwxrwxr-x 1 root root 11734780 Nov 26 04:25 mysolution-linux-amd64
Removing intermediate container d17ec6b0c7af
---> 56a879ef9440
Step 8/8 : ENTRYPOINT ["/app/mysolution-linux-amd64"]
---> Running in 33bea73f14dc
Removing intermediate container 33bea73f14dc
---> ef794fe310bc
Successfully built ef794fe310bc
Successfully tagged newtech/mysolution:latest
I have use the Ubuntu Virtualbox.
Docker version : Docker version 20.10.12, build e91ed57
redis version: 3.0
From Ubuntu, I'm trying to initialize and connect to redis-vm server.
I have use following docker commands to build, create container and connect with the redis-server.
(base) root#adminsaturn-virtual-machine:/media/sf_scefwp01/redis# docker build --rm -f ./Dockerfile --tag redis:3.0 .
Sending build context to Docker daemon 1.571MB
Step 1/26 : FROM alpine:20210804 as redis-dev
---> 4e873038b87b
Step 2/26 : ENV REDIS_VERS "6.2.6"
---> Using cache
---> bd2bd3468229
Step 3/26 : ENV REDIS_REPO "https://github.com/redis/redis.git"
---> Using cache
---> 51831b501b6d
Step 4/26 : ENV REDISJSON_VERS "2.0.6"
---> Using cache
---> c9fbf3a205bc
Step 5/26 : ENV REDISJSON_REPO "https://github.com/RedisJSON/RedisJSON.git"
---> Using cache
---> a4d2767081c9
Step 6/26 : RUN apk add --no-cache coreutils gcc g++ cargo linux-headers make musl-dev git rust cargo clang-libs pkgconf
---> Using cache
---> a603a024df55
Step 7/26 : RUN git clone --depth 1 --branch ${REDIS_VERS} ${REDIS_REPO} redis && cd /redis && make -j "$(nproc)" && make install
---> Using cache
---> b784b1ea27e4
Step 8/26 : FROM alpine:3.14
---> dd53f409bf0b
Step 9/26 : RUN sed -i 's/https/http/' /etc/apk/repositories
---> Using cache
---> d5f72fd3c94e
Step 10/26 : RUN apk update && apk add bash
---> Using cache
---> fe89e27870d6
Step 11/26 : RUN apk add libgcc
---> Using cache
---> d4f8dec09ec0
Step 12/26 : RUN apk add --no-cache python3
---> Using cache
---> 558f61bd0567
Step 13/26 : RUN apk add --no-cache py3-pip
---> Using cache
---> f21fc80a1225
Step 14/26 : RUN pip3 install redis
---> Using cache
---> 634aae092977
Step 15/26 : RUN pip3 install pytest
---> Using cache
---> f03644be4ca8
Step 16/26 : COPY sysvar-py/ /sysvar-py/
---> Using cache
---> ca867b2bbc2e
Step 17/26 : ENV REDIS_URL=redis://localhost:6379
---> Using cache
---> 8e4ece4479d3
Step 18/26 : COPY startup/ /startup/
---> Using cache
---> fefed1c53dee
Step 19/26 : COPY --from=redis-dev /usr/local/bin/redis-* /usr/local/bin/
---> Using cache
---> 110bb43f3cfc
Step 20/26 : RUN mkdir /etc/redis
---> Using cache
---> 80f3fc513310
Step 21/26 : COPY --from=redis-dev /redis/redis.conf /etc/redis/
---> Using cache
---> 0fc7280f6738
Step 22/26 : RUN mkdir -p /usr/local/etc/redis
---> Using cache
---> 362645872a09
Step 23/26 : COPY redis.conf /usr/local/etc/redis/
---> Using cache
---> 9c545d22358f
Step 24/26 : EXPOSE 6379/tcp
---> Using cache
---> d41a476122fd
Step 25/26 : WORKDIR /sysvar-py
---> Using cache
---> 0cd5f4246142
Step 26/26 : ENTRYPOINT ["/startup/startup.sh"]
---> Using cache
---> 20ee87c5f5f4
Successfully built 20ee87c5f5f4
Successfully tagged redis:3.0
(base) root#adminsaturn-virtual-machine:/media/sf_scefwp01/redis# docker run --name=redis --publish=6379:6379 --hostname=redis --mount type=bind,source=/run,target=/run --detach redis:3.0
1fe16baec197920588783968fea43ceaba8286117d95b49e4d59b5a840d04241
(base) root#adminsaturn-virtual-machine:/media/sf_scefwp01/redis# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1fe16baec197 redis:3.0 "/startup/startup.sh" 5 seconds ago Exited (1) 4 seconds ago redis
c1aa99b92eca redis "docker-entrypoint.s…" 25 hours ago Exited (0) 25 hours ago funny_nobel
e236678456e2 redis "docker-entrypoint.s…" 25 hours ago Exited (0) 25 hours ago quirky_lovelace
2772ad6a9c9b 4e873038b87b "/bin/sh -c 'apk upd…" 28 hours ago Exited (2) 28 hours ago crazy_cohen
f34c6d1fde05 4e873038b87b "/bin/sh -c 'apk upd…" 28 hours ago Exited (2) 28 hours ago ecstatic_taussig
(base) root#adminsaturn-virtual-machine:/media/sf_scefwp01/redis# docker exec -it redis bash
Error response from daemon: Container 1fe16baec197920588783968fea43ceaba8286117d95b49e4d59b5a840d04241 is not running
Here you can see build and container creating successfully but redis-server exited immediately.
if we apply the docker exec -it redis bash command then getting Error response:Container is not running.
how can I fix this issue?
Kindly provide me suggestion.
I have a NODE.js application which will run only in the Windows environment.
I am running docker desktop on windows 10 Enterprise edition. Docker server version: 20.10.14. So I have switched to the windows container in the docker desktop to create a windows container.
When I am running the container using the docker run command, the container does not start and throws the error.
C:\Users\app>docker run -d helloapp:latest -p 8085:8085
7286c4a0d38c87ec09c009a59cdda527f939f7e7b2814c2324f52cd454744658.
docker: Error response from daemon: container 7286c4a0d38c87ec09c009a59 encountered an error during hcsshim::System::CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2)
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(174)\vmcomputeagent.exe!00007FF67F5BC00A: (caller: 00007FF67F58ECEA) Exception(2) tid(36c) 80070002 The system cannot find the file specified.
CallContext:[\Bridge_ProcessMessage\ComputeSystemManager_ExecuteProcess\VmHostedContainer_ExecuteProcess]
Provider: 00000000-0000-0000-0000-000000000000].
Here is my docker file:
FROM customnode/node:12.14.1
RUN mkdir C:\\applications\\docker-firstapp
COPY myfirstapp C:\\applications\\docker-firstapp
WORKDIR C:\\applications\\docker-firstapp
RUN npm install
ENV PORT=8085
ENV SQL_USER=username
ENV SQL_PASSWORD=passwd
ENV SQL_SERVER=serverip
ENV SQL_SERVER_DB=dbname
ENV SQL_SERVER_PORT=1433
RUN npm run build
CMD ["npm", "run prod", "--port 8085"]
My folder structure:
*+--- myfirstapp
--- .dockerignore
--- Dockerfile*
For building the image:
docker build -t helloapp .
For running the container:
docker run -d helloapp:latest -p 8085:8085
Docker build logs:
C:\Users\app>docker build -t helloapp .
Sending build context to Docker daemon 12.85MB
Step 1/12 : FROM customnode/node:12.14.1
12.14.1: Pulling from customnode/node
e46122273a4e: Pull complete
c37a24ce81a9: Pull complete
Digest: sha256:ccd9d53710c8b8f8fd4bb779afe79bhd8d45dugf44c4ddf7b7f655ea5cbfe540550cd892c
Status: Downloaded newer image for customnode/node:12.14.1
---> 2cb9637cf0ec
Step 2/12 : RUN mkdir C:\\applications\\docker-firstapp
---> Running in b5c9bc1fabe0
Removing intermediate container b5c9bc1fabe0
---> bc300a981554
Step 3/12 : COPY myfirstapp C:\\applications\\docker-firstapp
---> b039e12ed5de
Step 4/12 : WORKDIR C:\\applications\\docker-firstapp
---> Running in a522ca627602
Removing intermediate container a522ca627602
---> fe67791910c9
Step 5/12 : RUN npm install
---> Running in 796e435a9ecf
added 628 packages from 996 contributors in 63.929s
Removing intermediate container 796e435a9ecf
---> 2301e525f348
Step 6/12 : ENV PORT=8085
---> Running in 43b2cfe4f50b
Removing intermediate container 43b2cfe4f50b
---> 56babd0dfc87
Step 7/12 : ENV SQL_USER=username
---> Running in 7a7b5c3164c3
Removing intermediate container 7a7b5c3164c3
---> cff0b54056f6
Step 8/12 : SQL_PASSWORD=passwd
---> Running in 162832e5b80d
Removing intermediate container 162832e5b80d
---> c4cc16d73439
Step 9/12 : ENV SQL_SERVER=serverip
---> Running in 22f010aaa9c6
Removing intermediate container 22f010aaa9c6
---> fba9cb278a2a
Step 10/12 : ENV SQL_SERVER_DB=dbname
---> Running in 37f14891e5ed
Removing intermediate container 37f14891e5ed
---> 22477a823bdd
Step 11/12 : ENV SQL_SERVER_PORT=1433
---> Running in a0b9ec381efd
Removing intermediate container a0b9ec381efd
---> 30bc3fb6d543
Step 12/12 : RUN npm run build
---> Running in f6b3b0c7ec9b
> nodewithtypescript#1.0.0 build C:\applications\docker-firstapp
> tsc
Removing intermediate container f6b3b0c7ec9b
---> da1352245135
Step 12/12 : CMD ["npm", "run prod", "--port 8085"]
---> Running in 744719faa7c3
Removing intermediate container 744719faa7c3
---> 1912b73a80d5
Successfully built 1912b73a80d5
Successfully tagged helloapp:latest
its very strange,when i run docker build ,process paused,just as follows:
docker build -t registry.ap-southeast-1.aliyuncs.com/joyours_dev/cronjobonlinebackgroundtask:v1 -f Dockerfile.prod .
Sending build context to Docker daemon 25.14MB
Step 1/13 : FROM nginx
---> c316d5a335a5
Step 2/13 : COPY ./app /home/
---> Using cache
---> b3b5594156ff
Step 3/13 : WORKDIR /home
---> Using cache
---> e9fcfe5da215
Step 4/13 : ARG PROJECT_DIR=/var/petaplay/simplethai
---> Using cache
---> fa19c2174392
Step 5/13 : ARG MICROSERVICE_DIR=/var/petaplay/simplethai/microservice/
---> Using cache
---> c086111be060
Step 6/13 : ARG SERVICE_NAME=onlineservice
---> Using cache
---> e0e2035a756b
Step 7/13 : RUN mkdir -p $PROJECT_DIR/common/config
---> Running in 9b38ed579980
console stop at Step 7/13,
I have what I believe is a pretty simple setup.
I build a binary file outside of docker and then try to add it using this Dockerfile
FROM alpine
COPY apps/dist/apps /bin/
RUN chmod +x /bin/apps
RUN ls -al /bin | grep apps
CMD /bin/apps
And I think this should work.
The binary on its own seems to work on my host machine and I don't understand why it wouldn't on the docker image.
Anyways, the output I get is this:
docker build -t apps -f app.Dockerfile . && docker run apps
Sending build context to Docker daemon 287.5MB
Step 1/5 : alpine
---> d05cf6536f67
Step 2/5 : COPY apps/dist/apps /bin/
---> Using cache
---> c54d6d57154e
Step 3/5 : RUN chmod +x /bin/apps
---> Using cache
---> aa7e6adb0981
Step 4/5 : RUN ls -al /bin | grep apps
---> Running in 868c5e235d68
-rwxr-xr-x 1 root root 68395166 Dec 20 13:35 apps
Removing intermediate container 868c5e235d68
---> f052c06269b0
Step 5/5 : CMD /bin/apps
---> Running in 056fd02733e1
Removing intermediate container 056fd02733e1
---> 331600154cbe
Successfully built 331600154cbe
Successfully tagged apps:latest
/bin/sh: /bin/apps: not found
does this make sense, and am I just missing something obvious?
Your binary likely has dynamic links to libraries that don't exist inside the image filesystem. You can check those dynamic links with the ldd apps/dist/apps command.