I would like to run a notebook inside the docker file on Colab. Usually, when I am doing this in the local environment, it means I will open a port and install Jupyter notebook inside it. The reason why I want to do so is that it is easy to test certain parts of newly the code, and it is great for visualization. In general, I am not sure whether this is possible on Colab.
I am using Colab pro+, so I have access to the terminal.
From what I can search, it seems to indicate the following.
It is possible to install docker and run it just like in the terminal; see this post.
Two years ago, it seems that this wouldn't be possible, as is seen in this answer and this page on Github.
However, now that two years has passed, I am no longer sure whether it is possible.
Thank you very much.
Related
I am very new to Docker and learning about it. I have a question that might be very basic but I could not find the exact answer yet. So we know that using Docker we can containerize our apps so one app dependency will not have any effect on other apps. Suppose I have two apps on the host machine and both of the apps are in their own containers. Say, for example, one app is using python2 and another is using python3 (installed on their own containers). And just for the sake of argument, suppose that python3 has some features which are not present in python2. And I am working on both of the apps together. Now my question is when I work on a particular app, how can I use switch between the apps? I meant for example, inside a Database Management System we have different databases, and when we want to work on a particular database we write the command use <databaseName> and then we can work on that database. If both of my containers are running, when writing code, how can I specify or how does docker or my code editor know I want to work on the app which uses python2 now and then switch to another app that uses python3. Suppose, the host machine can not have both python2 and python3 together outside of containers. Thanks in advance.
So, I pulled the ros container from docker hub, using
docker pull ros
which got me the latest docker 'foxy' version.
I proceeded with the tutorial on starting the docker container of ROS. I could successfully start the container and connect to it. It's a small little tutorial. Nothing long nor complicated.
The penultimate step in that tutorial asks for sourcing gthe setup.bash file, which I did and received no errors. (Actually nothing at all. Neither success, nor failure came up).
source /opt/ros/<distro>/setup.bash
And after that, to taste the sweet fruit of my hard labour I entered the final command (as mentioned in the tutorial),
rostopic list
which returned to my surprise,
rostopic command not found
I proceeded then to enter at the terminal roscore, roscd, etc and none of them worked. All of them were not found.
I did try to just run that setup script myself, from the terminal without using source, like:
$ /opt/ros/foxy/setup.bash
(after changing the permissions of course), which brought little change to the situation.
I looked in at the docker page for ros and nothing helpful was to be found there. Plenty of instructions there about how to build my own docker image for ROS, but that is not what I want to do right now, I guess.
I googled and the hits on the first page were:
this (the original tutorial which I am anyways following),
this (something general about docker)
and,
this (about how to
run GUI with Docker - not there yet frankly),
which begs the question, what good is the container if I have to install everything myself anyways by following their other tutorial?
Or do I not understand something here? If someone could throw some light on it, it would be much appreciated.
Your container has ROS2, not ROS1. Try
ros2 topic list
If you want to get the ROS1 version instead, try pulling and running a different image instead:
docker pull ros:noetic-robot
docker run ros:noetic-robot
Context
The tutorial you are following was written some time ago, when the default container used ROS1. The new latest container uses ROS2 (in your case, Foxy). ROS2 doesn't have the same command names. rostopic does not work, and there isn't even a master, so roscore would make no sense!
The good news is, the tutorial page is a wiki, so I've already updated it to make it (at least slightly) clearer. If you have ideas for how to improve it, you could also make an account and do so.
Currently, I'm using bash script in order to execute docker commands.
For example docker-compose up -d is just command start inside the terminal and etc.
I have a lot of commands like this to start/stop/restart/execute some commands inside a container and etc.
Everything is working fine, but the problem is with the bash file there are too many if/else for all the commands. I'm trying to find another script language to do this, but not sure which will be cleaner(better to write). Does someone else use something similar?
I was thinking to use Python, but it needs to be something that requests a minimum work from the user side. The idea is just to download the docker repo and start using the commands that's why I'm using bash for now.
I would say that Python is an extremely good choice. The syntax is very easy to pick up, and there are many modules/libraries for infrastructure work.
Python is one of the most popular languages in the Ops/Devops world, so there will also be plenty of help online.
Google Cloud Run is new. Is it possible to run WordPress docker on it? Perhaps using gce as database for the mysql/mariadb. Can't find any discussion on this
Although I think this is possible, it's not a good use of your time to go through this exercise. Cloud Run might not be the right tool for the job.
UPDATE someone blogged a tutorial about this (use at your own risk): https://medium.com/acadevmy/how-to-install-a-wordpress-site-on-google-cloud-run-828bdc0d0e96
Here are a few points to consider;
(UPDATE: this is not true anymore) Currently Cloud Run doesn't support natively connecting to Cloud SQL (mysql). There's been some hacks like spinning up a cloudsql_proxy inside the container: How to securely connect to Cloud SQL from Cloud Run? which could work OK.
You need to prepare your wp-config.php beforehand and bake it into your container image. Since your container will be wiped away every now and then, you should install your blog (creates a wp-config.php) and bake the resulting file into the container image, so that when the container restarts, it doesn't lose your wp-config.php.
Persistent storage might be a problem: Similar to point #2, restarting a container will delete the files saved to the container after it started. You need to make sure stuff like installed plugins, image uploads etc SHOULD NOT write to the local filesystem of the container. (I'm not sure if wordpress lets you write such files to other places like GCS/S3 buckets.) To achieve this, you'd probably end up using something like the https://wordpress.org/plugins/wp-stateless/ plugin or gcs-media-plugin.
Any file written to local filesystem of a Cloud Run container also count towards your container's available memory, so your application may run out of memory if you keep writing files to it.
Long story short, if you can make sure your WP installation doesn't write/modify files on your local disk, it should be working fine.
I think Cloud Run might be the wrong tool for the job here since it runs "stateless" containers, and it's pretty damn hard to make WordPress stateless, especially if you're installing themes/plugins, configuring things etc. Not to mention, your Cloud SQL server won't be "serverless", and you'll be paying for it while it's not getting any requests as well.
(P.S. This would be a good exercise to try out and write a blog post about! If you do that, add it to the awesome-cloudrun repo.)
I'm looking for something like a --kernel option to runipy.
The purpose is to integration-test a docker container which is supposed to present an ipython notebook service. I'd like to check that an example notebook runs against that host and port.
As I think about it more, that probably means uploading the notebook in question to the docker container somehow, asking it to run the notebook, and checking that it did. Suggestions on making that not-obnoxious would be very welcome.
nbopen seems related, but also doesn't seem to let me specify a host and port.