Attach to existing container from command line - vscode-remote

I want to write a script, which run vscode in desired configuration:
vscode is attached to running container, which can be identified by docker ps | grep
select predefined path as folder
How it can be done?

Related

Access a database backup-file on mac? (.bak)

I'm running a localhost database through Docker on MAC. I have an assignment that requires me to hand in the .bak file along with the program I wrote. I'm using Azure Data Studio as DBMS. I can't find these anywhere and I've tried to google the matter but it doesn't seem as a common issue for other mac users.
How do i access these from Finder? Or is there another way to do this?
Accessing Docker Container File system from Mac OS host through this tutorial.
To access the file system of a particular Container, first, let us get the Container ID using the inspect command on the Docker Host.
docker inspect --format <Container Name>
Use the Alpine Docker image and mount your Host file system to the container
docker run --rm -it -v /:/vm-root alpine:edge sh
We need the ID of this container. So, you could combine the step 1 and 2 with the following
docker run --rm -it -e CONTAINER_ID=$(docker inspect --format <Container Name>) -v /:/vm-root alpine:edge sh
Now we have the CONTAINER_ID set as an environment variable in the alpine container.
Once you are in the alpine container, you can visit the following directory
cd /vm-root/var/lib/docker
Inside this directory, you will be able to access all the familiar files that you are used to when administering Docker
Now, we need to find the mount-id for the selected container to access the file system directories. We will use the CONTAINER_ID environment variable obtained in step 2. I have AUFS as my file system driver for the this example. To do that, use the following command.
MOUNT_ID=$(cat /vm-root/var/lib/docker/image/aufs/layerdb/mounts/$CONTAINER_ID/mount-id)
The above step will give you the mount-id. Now you can access the file system of the container under mnt directory with the mount-id
ls -ltr /vm-root/var/lib/docker/aufs/mnt/$MOUNT_ID

Docker command not able to pass parameter at runtime to a appConfig.json file

Hi i am new to docker(version 19.03.8) and basically I have an angularjs project(dummyPoject) which contains appConfig.json file with the following path dummyPoject\src\assets\conf\appConfig.json. The json file contains the following variable:
{
"baseUrl": "MAPPED-URL"
}
Basically I want to override the MAPPED-URL properties with the one that i am sending while executing docker command.
Based on the online documentation I found out that it can be passed as environment variable while running the docker command please find below:
docker run -e baseUrl=http://localhost:8081/dummyUrl/ -p 8000:8080 -d --name cms test:1.0
I was expecting that MAPPED-URL will change to http://localhost:8081/dummyUrl/ but it is not the case.
Anything I am missing here please?
By adding -e baseUrl=http://localhost:8081/dummyUrl/ to docker run you have successfully added a environment variable to your docker container. But this value will not magically replace values in your appConfig.json file.
You will need some sort of script that extracts the baseUrl variable from environment and replaces the value in the script. This could be done using a bash script which runs when the container starts and replaces the line "baseUrl": "MAPPED-URL" using the environment variable you added.
Update:
This question inspired me to create a small Node.js package command line package that should help solve your issue. The package is called replace-env
You can add replace-env to your package.json dependencies. You can then run the command as part of your Dockerfile build process, or you can have it modify the file at runtime by customizing your CMD instruction.

How to run C program in Netbeans

I am trying to run the dmtx project from Git (link: https://github.com/dmtx/dmtx-utils) in Netbeans. I have configured the Project Properties in NetBeans and the project is building correctly.
When I run a particular C file (dmtxwrite.c) through bash it gives the correct output. As mentioned in the README, the correct way to run it in Bash is:
$ echo -n 123456 | dmtxwrite > image.png.
Now my question is how can I do the same using NetBeans?
Till now I only found answers related to passing command line arguments. However, that does not work.
how can I do the same using NetBeans?
Select your C project in the Projects panel.
Right-click it to open the context menu, then select Properties > Run > Run Command.
Enter your command to be run in the Run Command field.
This is the Help for Run Command in NetBeans 8.2:
Enter a command to be executed when you run the project. The IDE runs the command as /bin/sh -c "run-command" which enables you to use any shell syntax including redirection and pipes. Type the command in the Run Command field the same way you would run it from the command line. For example, you could type my-script -opt1 -opt2 to run a script and specify two options, or mycommand > output.log to run your command and send the output to a logfile. The Run Command list maintains history of previous entries so you can go back to the default value or select among several different commands you have entered.

Unable to access a file copied in a container

I am tryng to run a java application in a container. In my docker file I copy the jar file and then run the jar
ADD project.jar /tmp/project.jar
CMD java -jar /tmp/project.jar
This fails with the following error Error: Unable to access jarfile /tmp/projct.jar However if I run the image with bash and manually navigate t o /tmp and run the java -jar command it works. Are there any more configurations I need to follow?

Sencha: How to generate all-classes file

Morning,
My production build seems to be missing getOrientation function.
It seems that sencha-touch-all.js is not being copied into the build folder.
After doing much forum reading, etc, I have discovered that I actually need to use Cmd to create an all-classes.js file.
According to http://docs.sencha.com/touch/2.2.0/#!/guide/building, the following command should do the job:
sencha create jsb -a index.html -p app.jsb3
When I run this in command from within the root of my app (where index.html lives), I get the following error:
[ERR] Unknown command: "create"
I have tried using commands generate or build instead of create but they do not work either.
So, why does it not recognise that command?
When I run the command from within my SenchaSDKTools folder, but use the full path/to/app,
it seems to accept the command, but does not create a file.
I have sencha touch 2.2.1 and Cmd 3.1.2.342
In order for you to use sencha create jsb command, you have to:
Install Sencha SDK Tools
Mac - http://cdn.sencha.io/sdk-tools/SenchaSDKTools-2.0.0-beta3-osx.app.zip
Windows - http://cdn.sencha.io/sdk-tools/SenchaSDKTools-2.0.0-beta3-windows.exe
Open terminal and change directory to where the Sencha SDK is installed.
cd /Applications/SenchaSDKTools-2.0.0-beta3/
Generate a JSB3 file by executing the ff. command:
/sencha create jsb -a index.html -p app.jsb3
wherein:
-a (required) The location of the HTML file containing the scripts you want to include
-p (required) The location where the output .jsb3 file should be created
This scans your index.html file for all framework and application files that are actually used by the app, and then creates a JSB file called app.jsb3.
SOLVED:
It was working fine from within the SenchaSDKtools folder. I hadn't told it the right place to create the file.

Resources