Skip to main content

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

  1. I appreciate your efforts of writing this informative article and I found exactly what I was looking for. So helpful and useful article. You can also visit my website of Social Media Marketing Agency Christchurch

    ReplyDelete

Post a Comment

Popular posts from this blog

Pgpool PgBouncer Postgresql streaming replication, load balancing and administration

The term scalability refers to the ability of a software system to grow as the business that uses it grows. PostgreSQL provides some features to help you build scalable solutions, but strictly speaking, PostgreSQL itself is not scalable. It can effectively use the following resources from one computer. Now, we will show you some configurations that may be useful for your use case. However, this can be problematic when distributing the database solution to multiple computers, because the standard PostgreSQL server can only run on a single computer. In this article, we will study different extension schemes and their implementation in PostgreSQL. Replication can be used in many expansion scenarios. Its main purpose is to create and maintain a backup database when the system fails. This is especially true for physical replication. However, replication can also be used to improve the performance of PostgreSQL-based solutions. Sometimes third-party tools can be used to implement complex exp

Tekstverwerking python Text processing python SpaCy, TensorFlow, NLTK, Allen-NLP, Stanford-NLP

 Dit post maakt gebruik van spaCy, een populaire Python-bibliotheek die de taalgegevens en algoritmen bevat die je nodig hebt om teksten in natuurlijke taal te verwerken. Zoals u in dit post zult leren, is spaCy gemakkelijk te gebruiken omdat het containerobjecten biedt die elementen van natuurlijke taalteksten vertegenwoordigen, zoals zinnen en woorden. Deze objecten hebben op hun beurt attributen die taalkenmerken vertegenwoordigen, zoals delen van spraak. Op het moment van schrijven bood spaCy voorgetrainde modellen aan voor Engels, Duits, Grieks, Spaans, Frans, Italiaans, Litouws, Noors Bokmål, Nederlands, Portugees en meerdere talen gecombineerd. Bovendien biedt spaCy ingebouwde visualizers die u programmatisch kunt aanroepen om een grafische weergave van de syntactische structuur van een zin of benoemde entiteiten in een document te genereren.   De spaCy-bibliotheek ondersteunt ook native geavanceerde NLP-functies die andere populaire NLP-bibliotheken voor Python niet hebben. Spa

Elasticsearch install and configuration on Ubuntu

If you plan to use elastic integrated with Django then it would be better to use an old version of Elastic or replace Haystack with Django-Elasticsearch-DSL (Not tested) See old version install at bottom of this post.  New version Elasticsearch ( attention no haystack at this time )  The Elasticsearch components are not available in Ubuntu’s default package repositories. They can, however, be installed with APT after adding Elastic’s package source list. curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation apt-get install gnupg curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)). OK echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list apt update apt