Docker getting started and apk add --no-cache python


The Getting Started project is a simple GitHub repository which contains everything you need to build an image and run it as a container.

Clone the repository by running Git in a container.


You can also type the command directly in a command line interface.





Now, build the image

A Docker image is a private file system just for your container. It provides all the files and code your container needs.






Ended with


=> CANCELED [base 4/4] RUN pip install -r requirements 7.5s

=> ERROR [app-base 2/8] RUN apk add --no-cache python 4.4s

------

> [app-base 2/8] RUN apk add --no-cache python g++ make:

#8 0.185 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz

#8 3.599 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz

#8 4.284 ERROR: unable to select packages:

#8 4.315 python (no such package):

#8 4.315 required by: world[python]

------

executor failed running [/bin/sh -c apk add --no-cache python g++ make]: exit code: 1


But python 3 and 2 are well installed on the desktop development machine.





Linking problem? Can solve it by symbolic link?



alias python=python3

alias pip=pip3



But which version of python is needed for this getting started? Ok, I think it will be an old version for this application and I will install the old requerted.

I understand New one is needed.


Collecting mkdocs==1.2.2 (from -r requirements.txt (line 1))

Could not find a version that satisfies the requirement mkdocs==1.2.2 (from -r requirements.txt (line 1)) (from versions: 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 0.11, 0.11.1, 0.12.0, 0.12.1, 0.12.2, 0.13.0, 0.13.1, 0.13.2, 0.13.3, 0.14.0, 0.15.0, 0.15.1, 0.15.2, 0.15.3, 0.16.0, 0.16.1, 0.16.2, 0.16.3, 0.17.0, 0.17.1, 0.17.2, 0.17.3, 0.17.4, 0.17.5, 1.0a1, 1.0b1, 1.0rc1, 1.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4)

No matching distribution found for mkdocs==1.2.2 (from -r requirements.txt (line 1))

You are using pip version 18.1, however version 20.3.4 is available.

You should consider upgrading via the 'pip install --upgrade pip' command.






sudo pip3 install --upgrade pip

sudo pip3 install -r requirements.txt


WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Well all that did not help. Wizard stops at 😐


ERROR [app-base 2/8] RUN apk add --no-cache python g++ make



So, the next step is running ends with.

sudo docker run -d -p 80:80

--name docker-tutorial docker101tutorial

Unable to find image 'docker101tutorial:latest' locally

docker: Error response from daemon: pull access denied for docker101tutorial, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.

See 'docker run --help'.


Very nice and easy getting started. I understand why so many specialists are sought for this technology.

Search the internet with something like “how to fix apk add --no-cache python g++ make” Then you see exactly the same problem.


https://github.com/docker/getting-started/issues/214




So, StefanScherer

Thanks @quinncomendant for the report. Indeed that package python was removed and now we would have to use python3 instead.

To make the tutorial a bit more stable I've merged #212 to remove this line. The tutorial should work for you again.

I'm working on a fix for Apple silicon/M1 users now.

For me not working.. 





You can try to edit this file and try again.


vim Dockerfile


Yeeees, this was a good solution. You have to replace python with python3.


Run your first container
Start a container based on the image you built in the previous step. Running a container launches your application with private resources, securely isolated from the rest of your machine.



docker run -d -p 80:80 --name docker-tutorial docker101tutorial

8824a1cd7716dfcb49b85a22ab4da1f7649d19bfbe406579064911defc81e73d

Now the wizard says. Now save and share your image
You must be signed in to Docker Hub to share your image.

Sign in here?
Save and share your image on Docker Hub to enable other users to easily download and run the image on any destination machine.

Wasn't really simple and not clear if it works or not how should I test it?

That was asked too early with login in my opinion.





Yeeees! Now I see it works.
Follow the tutorial in text format. I think you won't have that many problems with it.

In this starter we want only to highlight the Docker Dashboard, which gives you a quick view of the containers running on your machine. It gives you quick access to container logs, lets you get a shell inside the container, and lets you easily manage container lifecycles.


When you follow full tutorial on your local host http://localhost/tutorial/ i will better understand docker.



Getting started first


vim Dockerfile


FROM node:12-alpine

WORKDIR /app

COPY . .

RUN yarn install --production

CMD ["node", "src/index.js"]







docker run -dp 3000:3000 getting-started





vim src/static/js/app.js


Edit app


Rebuild



docker build -t getting-started .





docker ps

docker stop 3ff9f010a9f8


Since that is an obviously an interesting tool in development you have to be very careful with it in production. There is more to consider in production than just deploy. We don't have that many developers at the moment and that's probably why dockers is overkill for us at the moment.

In most cases it is much more stable to work just on the server especially when it comes to a python application these work much smoother without network layers. So with django I would choose virtual environment and configure everything directly on the host where you have to work or your development machine with virtual environment.







Comments