docker-compose IOError: Can not access file in context - docker

Docker build will build and run the image, but during docker-compose I get the following error:
> .\docker-compose-Windows-x86_64.exe -f C:\t\tea\docker-compose.yml up
Building web
Traceback (most recent call last):
File "docker-compose", line 6, in <module>
File "compose\cli\main.py", line 71, in main
File "compose\cli\main.py", line 127, in perform_command
File "compose\cli\main.py", line 1039, in up
File "compose\cli\main.py", line 1035, in up
File "compose\project.py", line 465, in up
File "compose\service.py", line 327, in ensure_image_exists
File "compose\service.py", line 999, in build
File "site-packages\docker\api\build.py", line 149, in build
File "site-packages\docker\utils\build.py", line 15, in tar
File "site-packages\docker\utils\utils.py", line 100, in create_archive
File "tarfile.py", line 1802, in gettarinfo
FileNotFoundError: [WinError 3] The system cannot find the path specified:
'C:\\t\\tea\\src\\app\\accSettings\\account-settings-main\\components\\account-settings-catalog\\components\\account-settings-copy-catalog-main\\components\\account-settings-copy-catalog-destination\\components\\account-settings-copy-destination-table\\account-settings-copy-destination-table.component.html'
[18400] Failed to execute script docker-compose
> docker -v
Docker version 18.03.0-ce-rc1, build c160c73
> docker-compose -v
docker-compose version 1.19.0, build 9e633ef3
I've enabled Win32 long paths in my local group policy editor, but not having any luck solving this issue.
Here is the docker-compose.yml if it helps:
version: '3'
services:
web:
image: web
build:
context: .
dockerfile: Dockerfile

This is a known issue under some circumstances with docker-compose. And, it is related to the MAX_PATH limitation of 260 characters on Windows.
Exerpt from the Microsoft docs on Maximum Path Length Limitation
In the Windows API (with some exceptions discussed in the following
paragraphs), the maximum length for a path is MAX_PATH, which is
defined as 260 characters.
From reading up on this, it seems that the solution depends on your docker-compose version and Windows version. Here's a summary of the solutions that I have found:
Solution #1
Upgrade to docker-compose version 1.23.0 or beyond. There is a bugfix in the 1.23.0 release described as:
Fixed an issue where paths longer than 260 characters on Windows
clients would cause docker-compose build to fail.
Solution #2
Enable NTFS long paths:
Hit the Windows key, type gpedit.msc and press Enter.
Navigate to Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem > NTFS.
Double click the Enable NTFS long paths option and enable it.
If you're using a version of Windows that does not provide access to Group Policy, you can edit the registry instead.
Hit the Windows key, type regedit and press Enter.
Navigate to HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\ CurrentVersion\Group Policy Objects\ {48981759-12F2-42A6-A048-028B3973495F} Machine\System\CurrentControlSet\Policies
Select the LongPathsEnabled key, or create it as a DWORD (32-bit) value if it does not exist.
Set the value to 1 and close the Registry Editor.
Solution #3
Install docker-compose via pip. This seems to have solve the issue for others that have come across this.
Expert from the docker-compose documentation:
For alpine, the following dependency packages are needed: py-pip,
python-dev, libffi-dev, openssl-dev, gcc, libc-dev, and make.
Compose can be installed from pypi using pip. If you install using
pip, we recommend that you use a virtualenv because many operating
systems have python system packages that conflict with docker-compose
dependencies. See the virtualenv tutorial to get started.
pip install docker-compose
If you are not using virtualenv,
sudo pip install docker-compose
pip version 6.0 or greater is
required.

Related

Error installing Nvidia Drivers Fedora 35 Kernel 5.16.15

Spent three days trying to install nvidia graphic card drivers in Fedora 35 running on kernel 5.16. I was installing from the download .run file which threw error 'MIGRATE_PFN_LOCKED' undeclared in /var/lib/dkms/nvidia/495.46/build/make.log
I tried installing without enabling dkms but still couldn't install the drivers
systemctl set-default multi-user.target
then
systemctl reboot
as root user. On logging in, change directory to where you download .run installer for your Nvidia graphic card and run below
sh ./NVIDIA-Linux-x86_64-XXX.XX.run --extract-only
Above extract the installer file which will give us ability to edit the driver source code. Use your favorite editor to open the file uvm_migrate_pageable.c which is located in your extracted driver folder as below:
kernel/nvidia-uvm/uvm_migrate_pageable.c
My favorite editor is vim, so in my case, I will open it for editing as below:-
vim /NVIDIA-Linux-x86_64-XXX.XX/kernel/nvidia-uvm/uvm_migrate_pageable.c
Add below lines on declaration part of the source file or before where it is referenced in this c source file.
#ifndef MIGRATE_PFN_LOCKED
#define MIGRATE_PFN_LOCKED 0
#endif
save the file and now run your driver as below while inside the folder we extracted:
./nvidia-installer
Installation process should now complete without any errors and you can now revert to your X windowing system by running the command:
systemctl set-default desktop.target
References:
https://bbs.archlinux.org/viewtopic.php?id=271400
https://github.com/torvalds/linux/commit/ab09243aa95a72bac5c71e852773de34116f8d0f
Issue: The NVIDIA team do not yet have support for kernel 5.16.15 for the time being.
Solution: Patch the current installer yourself by running below, note that you must have x disabled probably by logging into your fedora via text mode which can be achieved by running the command

Issue with docker-compose support while installing VECTR

I am trying to install VECTR on the GCP Ubuntu instance and following the official writeup for the same.
I used apt-get to install requirements (docker-ce, docker-ce-cli, containerd.io, docker-compose, unzip) on Ubuntu (GCP).
But while trying to run docker-compose up -d , I am getting issues with the docker-compose version.
ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a version of "2" (or "2.0") and place your service definitions under the services key, or omit the version key and place your service definitions at the root of the file to use version 1.
Changed docker-compose.yml file and padded version to 2.
But now getting a different issue:
ERROR: Invalid interpolation format for "ports" option in service "tomcat": "${VECTR_PORT:-8081}:8443"
The docker-compose distro has been deprecated. Instead, you should install docker-compose-plugin. This is going to be more important over time because the versions are getting very far apart (currently 1.25.X vs 2.6.X). Instead of executing docker-compose up, you will now execute the command:
docker compose up

xpra and sudo / what is the difference between sudo and "being a user"

I'm trying to create a docker image with xpra and chrome in it. As I also need to be able to use this base image to install further software I don't change the user at the end of the Dockerfile.
During a build I use this image for 2 purposes:
- build the final image
- use the base image to run xpra and chrome for build purposes
In the first occasion you need to be root, in the second occasion you need to be the chrome user. I tried to solve this by using sudo: (e.g. sudo -i -u chrome xpra ..., but this causes problems. If I change the base image to be the chrome user (USER CHROME in the Dockerfile), it works fine.
The full error I get:
2018-07-02 11:23:39,828 Error: cannot start the desktop server
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/xpra/scripts/server.py", line 1011, in run_server
app.setup()
File "/usr/lib/python2.7/dist-packages/xpra/server/server_base.py", line 119, in setup
c.setup(self)
File "/usr/lib/python2.7/dist-packages/xpra/server/mixins/audio_server.py", line 55, in setup
self.init_pulseaudio()
File "/usr/lib/python2.7/dist-packages/xpra/server/mixins/audio_server.py", line 117, in init_pulseaudio
os.mkdir(self.pulseaudio_private_dir, 0o700)
OSError: [Errno 2] No such file or directory: '/run/user/1000/xpra/pulse-:0'
2018-07-02 11:23:39,828 [Errno 2] No such file or directory: '/run/user/1000/xpra/pulse-:0'
the /run/user directory doesn't exist in either of the images.
I worked out the issue in the end, and know why I forgot in the first place (I have been able to work on this really fragmented only. The Docker file contained: ENV XDG_RUNTIME_DIR=/tmp
Basicly redirecting the runtime directory, but sudo actually removes that environment variable.

cp: cannot stat on ./startFabric.sh in Docker for Hyperledger Fabric-Writing Yout First Application

I am currently trying to learn Hyperledger Fabric. I have followed all the instructions till here. I have gotten all the necessary binaries and downloaded all the required samples. When I go into the Fabcar folder and use the "ls" command, I can see all the files expected according to the document EXCEPT chaincode.
$ ls
creds/ invoke.js package.json query.js startFabric.sh*
When I run "./startFabric.sh" command, I get the following errors:
$ ./startFabric.sh
cp: cannot stat '/c/Users/Vaibhav': No such file or directory
cp: cannot stat 'Shah/fabric-samples/fabcar/creds/*': No such file or directory
I am attaching a screenshot of the entire Docker interface below.
Thank you very much.
Screenshot of error in Docker
Check this example in https://github.com/hyperledger/fabric/tree/release/examples/e2e_cli
This is the end-to-end test of the fabric using the command line interface. It helps you understand installation, setting up channels and executing if I recall chaincode_example02. Obviously, this runs on Ubuntu 14.04.
If you are a Windows user, you may want to spin up an Ubuntu 14.04 VM and try out, after installing all the pre-requisites.

Docker hub automated build fails but locally does not

I have setup an automated build on Docker hub here (the sources are here).
The build goes well locally. I have also tried to rebuild it with --no-cache option:
docker build --no-cache .
And the process completes successfully
Successfully built 68b34a5f493a
However, the automated build fails on Docker hub with this error log:
...
Cloning into 'nerdtree'...
[91mVim: Warning: Output is not to a terminal
[0m
[91mVim: Warning: Input is not from a terminal
[0m
[m[m[0m[H[2J[24;1HError detected while processing command line:
E492: Not an editor command: PluginInstall
E492: Not an editor command: GoInstallBinaries
[91mmv: cannot stat `/go/bin/*': No such file or directory
[0m
This build apparently fails on the following vim command:
vim +PluginInstall +GoInstallBinaries +qall
Note that the warnings Output is not to a terminal and Input is not to a terminal appears also in the local build.
I cannot understand how this can happen. I am using a standard Ubuntu 14.04 system.
I finally figured it out. The issue was related to this one.
I am using Docker 1.0 in my host machine, however a later version is in production in Docker Hub. Without the explicit ENV HOME=... line in the Dockerfile, version 1.0 uses / as home directory, while /root is used by the later version. The result is that vim was not able to find its .vimrc file, since it was copied in / instead of /root. The solution I used is to explicitly define ENV HOME=/root in my Dockerfile, so there are no differences between the two versions.

Resources