Is there an alternative to usermod on MacOS? - macos

I want to build a docker image natively on a shell runner:
So I've been trying to register a GitLab runner with a shell executor on my local (MacOS) to build and run a docker image using this link:
https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-the-shell-executor
I have to run this command: sudo usermod -aG docker gitLab-runner to grant permissions to gitLab-runner.
However usermod doesn’t work on mac anymore, so I tried to follow a few StackOverflow links which told me to use sudo or dscl. None of them seem to be working.
The error I’m getting on the pipeline :
mkdir: /builds/ht8y-6qs/0/webapp.tmp: Read-only file system
Does anyone know a workaround?
Ps: I know the best way to do this would be inside a layer of virtualization but I still want to figure this out

Related

Docker is not running when run curl command to create new laravel project

I just start learning laravel, and follow the tutorial from https://laravel.com/docs/8.x/installation "Getting started on Windows" .
I manage to install Docker Desktop and COnfigured to use WSL2 Backend.
When I run the command curl -s https://laravel.build/example-app | bash to create laravel application directory from cmd, this warning come out Docker is not running.
I run curl using command prompt. (cmd).
Update:
So, I run the command in Windows Terminal:.
PS E:\Play> curl -s https://laravel.build/example-app | bash
Here is the response I get:
cmdlet Invoke-WebRequest at command pipeline position 1
Supply values for the following parameters:
Uri:
Any Idea what to do?
Try to explicitly enable integration with your distro in Docker settings:
After that relaunch your WSL2 terminal & try again. That should help.
You can also open https://laravel.build/example-app in a browser & check what commands the script is running: and run them manually to check the output for any errors.
For those who are using Ubuntu or Debian can check this guide out on how to install and configure Docker.
sudo snap install docker
sudo usermod -aG docker $(whoami)
sudo chmod 666 /var/run/docker.sock
You need to install a linux distro, and then in Windows Terminal create a new tab for the linux distro and run the command there, not in a windows powershell tab.
Make sure that you are running curl command on your distro. Use Windows Terminal app and open a new tab as WSL2 (your distro).
sudo chmod 666 /var/run/docker.sock
I guess you are using ubuntu or debian.
chmod will do the trick here.

Cannot mount a volume without using sudo

The following command works and mounts the local volume:
sudo docker run -ti -v "$PWD/codebase/realsmart-saml-copy":/var/www/html realsmart-docker_smartlogin bash
The following command does not work and does not mount the volume
docker run -ti -v "$PWD/codebase/realsmart-saml-copy":/var/www/html realsmart-docker_smartlogin bash
For some reason, docker is only able to mount volumes using the sudo command, rendering our local docker environment useless on a colleagues laptop. The same docker-compose file works on my laptop (also a mac, same OS).
Any idea as to what the issue might be with his laptop configuration? Or indeed the docker setup.
(The code extract is to make clear the problem with mounting volumes, the same issue presents itself using a compose.yml file.)
Non working code:
docker run -ti -v "$PWD/codebase/realsmart-saml-copy":/var/www/html realsmart-docker_smartlogin bash
No error messages are displayed, but the results are not as expected as the volume does not mount without using sudo.
Try to see if the user is part of the docker group.
It would make sense that sudo works, but not for the local user, if that local user is not part of the docker group.
The solution for anyone interested.
After upgrading to Docker Desktop Boot2Docker has been replaced.
Steps to fix the issue:
docker-machine rm machine-name
unset DOCKER_TLS_VERIFY
unset DOCKER_CERT_PATH
unset DOCKER_MACHINE_NAME
unset DOCKER_HOST
restart Docker Desktop
cd path/to/docker-project.
docker-compose build
docker-compose up (or docker run)
project now available on localhost
Further details: https://docs.docker.com/docker-for-mac/docker-toolbox/
Add your user to the docker group.
sudo usermod -aG docker $USER

Installing OpenFOAM through Docker

I'm having a bad time trying to install OpenFOAM using Docker(on a MacOSX El Capitan). I've been following the official tutorial.
When I try to execute the first script (installOpenFOAM+), through the command line:
docker-machine ssh default $HOME/installOpenFOAM+ $HOME
I get the following result on the terminal screen:
machine does not exist
I've been looking for a solution online over and over but it seems nobody has had an issue like this. Has someone here faced the same problem?
Try making the install script executable before the first script, it seems to work for some people. That is, use
chmod +x installOpenFOAM+
I also had tough time installing Openfoam using docker.
After you install docker, you need to create a virtual machine (named default).
Once it is done, change the permission of install script. Then try to install it.
docker-machine create --driver virtualbox default
chmod a+x installMacOpenFOAM+
docker-machine ssh default $HOME/installMacOpenFOAM+ $HOME
I am not able to stat the application.

TensorFlow docker dev workflow on mac

There is an official guide on how to install it that doesn't say much about actually developing in it.
From what I understand, there is a quite big challenge in developing with Docker in general. Not to mention there could be deeper technical complications about going with it for TensorFlow, maybe mostly thanks to GPUs. So there is a lot of stuff to after pulling the docker image...
Does anyone have a step by step guide on how to get development going here?
You could mount a local directory to the docker container so that you can still use your preferred editor in osx. Here's a command to start the container with a mounted directory and run a command:
docker run --name tensorflow --rm -v /Users/me/Code/web/tensorflow_dev:/tensorflow_dev b.gcr.io/tensorflow/tensorflow /bin/sh -c 'cd /tensorflow_dev && python mnist.py'
-v will mount the local directory and the -c will run the specified command. So your flow might look like:
Edit python script in your favorite editor
Run the above command to excute your script
However, I actually use pycharm so that I can place breakpoints and run the python script interactively within the editor.
Hope this helps.

Installing docker with devstack

I am trying to install devstack and docker (http://devstack.org/guides/single-machine.html) onto a VM containing Ubuntu 13.10 Server. devstack contains a docker installer script in tools/docker/install_docker.sh which it is recommended to run first before running the stack.sh installer script for devstack. I have patched the docker install script according to the bug report https://bugs.launchpad.net/devstack/+bug/1237581 however docker still reports a problem:
socat[NNNN] E connect(3, AF=1 "/var/run/docker.sock", 22): Connection refused
Does anyone know a fix for this problem?
Thanks,
David
If you get error messages regarding /var/run/docker.sock then either the docker daemon/service is not started or your user (devstack user) has no permissions.
Start docker:
service docker restart
Add your user (devstack user) to the docker group. Try to enumerate containers:
docker ps
If that still does not fix the problem then you might want to change the permission of /var/run/docker.sock directly:
sudo chown vagrant:vagrant /var/run/docker.sock
Check your kernel ( uname -a ) and make sure it is 3.8 or latest. Also, make sure you are on a 64bit Ubuntu ( X86_64 distribution ). The point is that the Docker daemon might not be starting (fails) because it is not supported on a 32 bit distribution.

Resources